Generate professional documents in multiple formats (PDF, DOCX, HTML, ODT, EPUB, RTF). Use when the user says "make a PDF", "generate a report", "create a document", "export to Word", "make a Word doc", "convert to PDF", "export findings", "create documentation", or wants to save analysis results as a formatted document.
Generate professional documents in multiple formats from markdown content using pandoc.
Requires pandoc. For PDF output, also requires a LaTeX distribution (e.g., basictex on macOS, texlive-xetex on Ubuntu/Debian).
Check pandoc availability: Run which pandoc. If not found, inform the user of installation requirements.
Collect content: Gather content from the conversation (security findings, code reviews, research summaries, meeting notes, etc.) or from files the user points to.
Determine format: Infer from context or ask the user:
Structure the document: Organize content into well-formatted markdown with YAML frontmatter, sections, and appropriate formatting. See references/templates.md for content-type-specific templates (security reports, code reviews, research summaries).
Write markdown to temp file: Save content to /tmp/document_<timestamp>.md
Convert with pandoc: Run the appropriate command from the format reference below.
Clean up: Delete the temporary markdown file after successful conversion.
Report output: Tell the user the output path and suggest how to open it.
pandoc /tmp/document.md -o ./report.pdf \
--pdf-engine=xelatex \
-V geometry:margin=1in \
-V fontsize=11pt \
--toc \
--highlight-style=tango
pandoc /tmp/document.md -o ./report.pdf \
--pdf-engine=wkhtmltopdf \
--css=/tmp/style.css
pandoc /tmp/document.md -o ./report.docx \
--toc \
--highlight-style=tango
pandoc /tmp/document.md -o ./report.html \
--standalone \
--toc \
--highlight-style=tango \
--metadata title="Report Title"
pandoc /tmp/document.md -o ./report.odt \
--toc
pandoc /tmp/document.md -o ./report.epub \
--toc \
--epub-chapter-level=2
pandoc /tmp/document.md -o ./report.rtf
pandoc /tmp/document.md -o ./report.txt \
--wrap=auto
Structure markdown content following this template. Adapt sections based on content type.
---