
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview
Retire the defunct microwave service and give article-style documents a first-class path to KPUB (self-contained HTML article). A chef references a source document and it becomes a validated KPUB automatically:
ContentNode(uri="article.docx") # → validated KPUB in the channel
Complexity: Medium
Target branch: main
Context
microwave (http://35.185.105.222:8989/unoconv/pdf) is dead.
- It is referenced only in
docs/examples/document_conversion.ipynb — no runtime code uses it.
- It documented a manual workflow: convert an office doc to PDF out-of-band, then add the PDF.
- KPUB is already supported end-to-end (
KPUBConversionHandler + KPUBMetadataExtractor); no path exists to produce one from a source document.
- The CONVERT stage rewrites the working file's extension, so a handler emitting
.kpub feeds the existing KPUBMetadataExtractor — net new code is one handler plus the sanitizer.
- Kolibri's KPUB renderer strips all CSS at runtime; ricecooker's validator only forbids external
.css.
- Selector-bearing
<style> can leak into Kolibri chrome; element-scoped style= is safe when bounded to an allowlist.
- The Studio rich text editor (TipTap v3) emits exactly one inline style —
text-align — on <p>, <h1>–<h3>, <small>, <img>; every other format is a semantic tag.
The Change
- Add a CONVERT-stage handler converting
.docx, .odt, .rtf, .md, .markdown → KPUB via pandoc.
- Emit semantic-only HTML: images as sibling files (
--extract-media), math as presentation MathML.
- Tighten
KPUBConversionHandler into a sanitizer applied to all KPUB (converted and hand-authored).
- Sanitizer: strip every
<style> block.
- Sanitizer: on
style=, keep only allowlisted properties, drop the rest.
- Sanitizer: strip offending CSS rather than reject the file; keep the existing
<script>/.js/.css bans.
- CSS
style= allowlist v1 = {text-align, color, background-color}, a ricecooker-local constant. text-align from the Studio RTE; color/background-color for source-doc text and highlight colours. Widening further requires extending the RTE first.
- Change
GoogleDriveHandler to export Google Docs as .docx (currently PDF); Google Slides stay PDF.
- Rewrite
docs/examples/document_conversion.ipynb around the new workflow; remove the dead service and IP.
- Document
pandoc as a system dependency (alongside ffmpeg/poppler) and install it in CI on all supported OSes.
- Render math as MathML (MathJax needs no LaTeX present); a LaTeX
<annotation> for source preservation is a verify-then-implement enhancement, not a blocker.
Out of Scope
- Presentations (
.pptx/.ppt) and spreadsheets (.xlsx/.xls) — not article content.
- Legacy
.doc — pandoc can't read the binary format.
.epub (native EPUB) and .html/zipped HTML (HTML5) — not claimed by the new handler.
- Widening the allowlist beyond
{text-align, color, background-color}.
- The coupled Kolibri renderer change to honor the allowlist instead of stripping all CSS — tracked as a separate Kolibri issue.
- Any hosted or self-hosted conversion service.
Acceptance Criteria
References
ricecooker/utils/pipeline/convert.py — KPUBConversionHandler, ConversionStageHandler
ricecooker/utils/pipeline/transfer.py — GoogleDriveHandler.GOOGLE_WORKSPACE_FORMATS
- Studio RTE (allowlist source of truth):
contentcuration/.../frontend/shared/views/TipTapEditor/
AI usage
Used Claude Code (Opus) to draft this issue and map the codebase from a live brainstorming dialogue that I directed. Codebase claims (microwave is docs-only; the RTE emits only text-align) were verified against the ricecooker and studio repos.
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Retire the defunct
microwaveservice and give article-style documents a first-class path to KPUB (self-contained HTML article). A chef references a source document and it becomes a validated KPUB automatically:Complexity: Medium
Target branch: main
Context
microwave(http://35.185.105.222:8989/unoconv/pdf) is dead.docs/examples/document_conversion.ipynb— no runtime code uses it.KPUBConversionHandler+KPUBMetadataExtractor); no path exists to produce one from a source document..kpubfeeds the existingKPUBMetadataExtractor— net new code is one handler plus the sanitizer..css.<style>can leak into Kolibri chrome; element-scopedstyle=is safe when bounded to an allowlist.text-align— on<p>,<h1>–<h3>,<small>,<img>; every other format is a semantic tag.The Change
.docx,.odt,.rtf,.md,.markdown→ KPUB viapandoc.--extract-media), math as presentation MathML.KPUBConversionHandlerinto a sanitizer applied to all KPUB (converted and hand-authored).<style>block.style=, keep only allowlisted properties, drop the rest.<script>/.js/.cssbans.style=allowlist v1 ={text-align, color, background-color}, a ricecooker-local constant.text-alignfrom the Studio RTE;color/background-colorfor source-doc text and highlight colours. Widening further requires extending the RTE first.GoogleDriveHandlerto export Google Docs as.docx(currently PDF); Google Slides stay PDF.docs/examples/document_conversion.ipynbaround the new workflow; remove the dead service and IP.pandocas a system dependency (alongside ffmpeg/poppler) and install it in CI on all supported OSes.<annotation>for source preservation is a verify-then-implement enhancement, not a blocker.Out of Scope
.pptx/.ppt) and spreadsheets (.xlsx/.xls) — not article content..doc— pandoc can't read the binary format..epub(native EPUB) and.html/zipped HTML (HTML5) — not claimed by the new handler.{text-align, color, background-color}.Acceptance Criteria
ContentNode(uri="article.docx")(and.odt,.rtf,.md,.markdown) produces a valid KPUB through the pipeline with no manual pre-conversion.index.htmlwith a non-empty body and no<script>/.js/.css/<style>.media/and are referenced by relative path.<math>) in the output.KPUBConversionHandlerstrips all<style>blocks from any KPUB (converted and hand-authored).style=withtext-align,color, orbackground-colorsurvives sanitization.style=property (e.g.position) is dropped; a mixed attribute keeps only the allowlisted properties.GoogleDriveHandlerexport as.docxand convert to KPUB.pandocis documented as a system dependency and installed in CI on all supported OSes.docs/examples/document_conversion.ipynbno longer referencesmicrowaveor the dead IP.References
ricecooker/utils/pipeline/convert.py—KPUBConversionHandler,ConversionStageHandlerricecooker/utils/pipeline/transfer.py—GoogleDriveHandler.GOOGLE_WORKSPACE_FORMATScontentcuration/.../frontend/shared/views/TipTapEditor/AI usage
Used Claude Code (Opus) to draft this issue and map the codebase from a live brainstorming dialogue that I directed. Codebase claims (microwave is docs-only; the RTE emits only
text-align) were verified against the ricecooker and studio repos.