Convert Document
Follow the document-generator skill (${CLAUDE_PLUGIN_ROOT}/skills/document-generator/SKILL.md), section Format Conversion, for the engines and the file naming; read it before Step 1.
Convert a document between formats using pandoc.
Arguments
Format: <input-file> --to <format>
- input-file: Path to the source file (required)
- --to: Target format -- pdf, docx, html, md, pptx (required)
Parse from "$ARGUMENTS".
Supported Conversions
| From |
To |
| Markdown (.md) |
PDF, DOCX, HTML, PPTX |
| DOCX (.docx) |
PDF, Markdown, HTML |
| HTML (.html) |
PDF, DOCX, Markdown |
Process
Validate input file exists:
Use Read (or test -f <input-file> via Bash) to confirm the file is present.
Plugin directory:
The converter is ${CLAUDE_PLUGIN_ROOT}/scripts/convert.sh (Claude Code substitutes ${CLAUDE_PLUGIN_ROOT} with the installed plugin path). Do not search for the plugin.
Check pandoc is installed:
which pandoc
If missing, tell user: brew install pandoc (macOS) or apt install pandoc (Linux).
Determine output filename:
Same name as input, with new extension. Example: report.md -> report.pdf.
Run conversion:
"${CLAUDE_PLUGIN_ROOT}/scripts/convert.sh" <input-file> <output-file>
Parse output:
Script returns JSON: { "success": true, "outputPath": "...", "size": N }.
Show the output file path and size.
For --to pdf the script needs a pandoc PDF engine (WeasyPrint, Typst or pdflatex); if none is found it says what to install. A DOCX source can also go through the Playwright converter it names in fallbackCmd.
For --to docx, pandoc takes the structure (headings, lists, tables) from the source; the look comes from the plugin's assets/reference.docx. Pandoc ignores CSS, so do not promise that an HTML or PDF-styled source keeps its styling in the DOCX.
Example Usage
/document-generator-ops:convert-document report.md --to pdf
/document-generator-ops:convert-document proposal.docx --to pdf
/document-generator-ops:convert-document notes.md --to docx
1---2name: convert-document3description: 'Convert between document formats (MD/DOCX/PDF/HTML/PPTX) Arguments: <input-file> --to <format>.'4metadata:5 source: https://skillmd.com/skills/agents-store/convert-document6---78# Convert Document910Follow the `document-generator` skill (`${CLAUDE_PLUGIN_ROOT}/skills/document-generator/SKILL.md`), section Format Conversion, for the engines and the file naming; read it before Step 1.1112Convert a document between formats using pandoc.1314## Arguments1516Format: `<input-file> --to <format>`17- input-file: Path to the source file (required)18- --to: Target format -- pdf, docx, html, md, pptx (required)1920Parse from "$ARGUMENTS".2122## Supported Conversions2324| From | To |25|------|----|26| Markdown (.md) | PDF, DOCX, HTML, PPTX |27| DOCX (.docx) | PDF, Markdown, HTML |28| HTML (.html) | PDF, DOCX, Markdown |2930## Process31321. **Validate input file exists:**33 Use Read (or `test -f <input-file>` via Bash) to confirm the file is present.34352. **Plugin directory:**36 The converter is `${CLAUDE_PLUGIN_ROOT}/scripts/convert.sh` (Claude Code substitutes `${CLAUDE_PLUGIN_ROOT}` with the installed plugin path). Do not search for the plugin.37383. **Check pandoc is installed:**39 ```bash40 which pandoc41 ```42 If missing, tell user: `brew install pandoc` (macOS) or `apt install pandoc` (Linux).43444. **Determine output filename:**45 Same name as input, with new extension. Example: `report.md` -> `report.pdf`.46475. **Run conversion:**48 ```bash49 "${CLAUDE_PLUGIN_ROOT}/scripts/convert.sh" <input-file> <output-file>50 ```51526. **Parse output:**53 Script returns JSON: `{ "success": true, "outputPath": "...", "size": N }`.54 Show the output file path and size.55 For `--to pdf` the script needs a pandoc PDF engine (WeasyPrint, Typst or pdflatex); if none is found it says what to install. A DOCX source can also go through the Playwright converter it names in `fallbackCmd`.56 For `--to docx`, pandoc takes the structure (headings, lists, tables) from the source; the look comes from the plugin's `assets/reference.docx`. Pandoc ignores CSS, so do not promise that an HTML or PDF-styled source keeps its styling in the DOCX.5758## Example Usage59```60/document-generator-ops:convert-document report.md --to pdf61/document-generator-ops:convert-document proposal.docx --to pdf62/document-generator-ops:convert-document notes.md --to docx63```