First converge the content into an auditable source, then generate for each delivery format a version it can faithfully express. HTML preserves interactive media; DOCX, PDF, and Markdown generate editable or printable static projections, and preserve covers, descriptions, and original links for media.
Triggers
- The user requests one-click export of a piece of content or product data as HTML, Markdown, DOCX, PDF, ZIP, or an offline delivery package.
- The user requests exporting content containing images, audio, video, iframes, interactive charts, or media descriptions, and needs correct handling for different formats.
- The user needs to integrate reusable multi-format export capability into a web, desktop, or server-side product.
Do not activate when
- Only need to edit a local part of an existing DOCX, PDF, or web page, and multi-format delivery is not involved.
- Only need to generate a single image, a single slide, or a single video file; use the corresponding media production workflow.
First Define Content Boundaries
- Treat names, project background, internal status, prompts, and the creative process in the chat as internal context; only fields that the user requests to appear in the final product enter the input content.
- When generating titles, authors, covers, footers, and file names, only read explicit
documentmetadata; do not infer or add personal information from the chat background. - When there is video, audio, a map, an embedded web page, or an interactive chart, first declare its static projection. When there is no cover, PDF/DOCX should at least preserve the name, summary, and accessible link.
Input and Commands
The default input is .md; .html and the rich-export.jsondefined by this Skill are also supported. Relative resources in the input are resolved relative to the input file.
python3 "$SKILL_DIR/scripts/export_rich.py" \
--input ./release/article.md \
--out ./release/exports \
--formats html-single,html-dir,md,docx,pdf \
--zip
First use --formats to generate only the format the user needs.html-single is suitable for direct sending and offline opening;html-dir is suitable when videos are large, there are many files, or the original media files need to be preserved;docx is suitable for continued editing;pdf is suitable for printing and archiving;md is the traceable source document.
Run python3 "$SKILL_DIR/scripts/export_rich.py" --help to view dependencies and options. For the complete input contract, see references/format-contract.md, and for product integration, see references/product-integration.md。
Rendering Strategy
| Target | Generation Method | Media Behavior |
|---|---|---|
| Single-file HTML | Pandoc --embed-resources |
Embed images, styles, scripts, audio, and video; large files will expand significantly |
| HTML folder | Pandoc + assets/ |
Preserve interactivity and independent resources, suitable for actual distribution |
| Markdown | Pandoc normalization | Preserve images and links; media uses explicit links |
| DOCX | Pandoc + optional reference.docx | Images are embedded; video/audio/iframe are projected as covers, descriptions, and links |
| Chromium/Playwright prints static HTML | Images and layout are preserved; media is projected as covers, descriptions, and links |
Do not treat single-file HTML as the default delivery for large videos. When the total media size exceeds about 20 MB, by default also deliver html-dir; if the user must receive only one file, deliver a ZIP containing the HTML folder and export-manifest.json。
Acceptance
Perform the following checks after each export:
- Open the single-file HTML and refresh with the network disconnected; check fonts, images, audio/video controls, table of contents, and links.
- Unzip/open the HTML folder; check that all resources of
index.htmlcome from within the package and that there are no absolute local paths. - Open the DOCX with Word/LibreOffice; check Chinese fonts, tables, images, pagination, and every media link.
- Render the PDF's first page, pages containing images, pages containing media projections, and the last page; check for cropping, overflow, garbled text, links, and page numbers.
- Check the
export-manifest.jsonofwarnings; internal metadata or prompts must not be exported as body text.
Choices and Limitations
- By default, Pandoc + Playwright is used: the former handles structured format conversion, and the latter reliably prints the confirmed web layout to PDF.
- The existing
lovstudio-any2pdf、lovstudio-any2docxis still suitable for specialized artistic layout of long Chinese text; this Skill handles multi-format single-source delivery and rich media fallback strategies. - SingleFile CLI is not made a built-in product dependency: its open-source repository is AGPL, and it is better suited to web archiving, not a multi-format content publishing pipeline.
- HTML and print/office formats are not equivalent. Interactive charts, iframes, and media playback capabilities are only preserved faithfully in HTML; other formats should deliver the information and access paths completely, rather than pretending to be playable content.