convert-contents
Converts content between multiple document formats using Pandoc. Specify input and output formats, file paths, and optional filters for customized transformations.
Instructions
Converts content between different formats. Transforms input content from any supported format into the specified output format.
šØ CRITICAL REQUIREMENTS - PLEASE READ:
PDF Conversion:
You MUST install TeX Live BEFORE attempting PDF conversion:
Ubuntu/Debian:
sudo apt-get install texlive-xetexmacOS:
brew install texliveWindows: Install MiKTeX or TeX Live from https://miktex.org/ or https://tug.org/texlive/
PDF conversion will FAIL without this installation
File Paths - EXPLICIT REQUIREMENTS:
When asked to save or convert to a file, you MUST provide:
Complete directory path
Filename
File extension
Example request: 'Write a story and save as PDF'
You MUST specify: '/path/to/story.pdf' or 'C:\Documents\story.pdf'
The tool will NOT automatically generate filenames or extensions
File Location After Conversion:
After successful conversion, the tool will display the exact path where the file is saved
Look for message: 'Content successfully converted and saved to: [file_path]'
You can find your converted file at the specified location
If no path is specified, files may be saved in system temp directory (/tmp/ on Unix systems)
For better control, always provide explicit output file paths
Supported formats:
Basic (returned inline): txt, html, markdown, ipynb
Advanced (REQUIRE complete file paths): pdf, docx, rst, latex, epub, odt, pptx
pptx is WRITE-ONLY: it can be produced, but not used as an input format ā CORRECT Usage Examples:
'Convert this text to HTML' (basic conversion)
Tool will show converted content
'Save this text as PDF at /documents/story.pdf'
Correct: specifies path + filename + extension
Tool will show: 'Content successfully converted and saved to: /documents/story.pdf'
ā INCORRECT Usage Examples:
'Save this as PDF in /documents/'
Missing filename and extension
'Convert to PDF'
Missing complete file path
When requesting conversion, ALWAYS specify:
The content or input file
The desired output format
For advanced formats: complete output path + filename + extension Example: 'Convert this markdown to PDF and save as /path/to/output.pdf'
šØ DOCX, ODT & PPTX STYLING: 4. Custom Styling with Reference Documents:
Use reference_doc parameter to apply professional styling to DOCX, ODT and PPTX output
The reference document MUST match the output format: .docx for docx, .odt for odt, .pptx for pptx
Create custom templates with your branding, fonts, and formatting
Perfect for corporate reports, academic papers, and professional documents
Example: 'Convert this report to DOCX using /templates/corporate-style.docx as reference and save as /reports/Q4-report.docx'
šÆ PANDOC FILTERS (NEW FEATURE): 5. Pandoc Filter Support:
Use filters parameter to apply custom Pandoc filters during conversion
Filters are Python scripts that modify document content during processing
Perfect for Mermaid diagram conversion, custom styling, and content transformation
Example: 'Convert this markdown with mermaid diagrams to DOCX using filters=["./filters/mermaid-to-png-vibrant.py"] and save as /reports/diagram-report.docx'
š Creating Reference Documents:
Generate template: pandoc -o template.docx --print-default-data-file reference.docx
Customize in Word/LibreOffice: fonts, colors, headers, margins
Use for consistent branding across all documents
š Filter Requirements:
Filters must be executable Python scripts
Use absolute paths or paths relative to current working directory
Filters are applied in the order specified
Common filters: mermaid conversion, color processing, table formatting
š Defaults File Support (NEW FEATURE): 7. Pandoc Defaults File Support:
Use defaults_file parameter to specify a YAML configuration file
Similar to using pandoc -d option in the command line
Allows setting multiple options in a single file
Options in the defaults file can include filters, reference-doc, and other Pandoc options
Example: 'Convert this markdown to DOCX using defaults_file="/path/to/defaults.yaml" and save as /reports/report.docx'
Note: After conversion, always check the success message for the exact file location.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filters | No | List of Pandoc filter paths to apply during conversion. Filters are applied in the order specified. | |
| contents | No | The content to be converted (required if input_file not provided) | |
| input_file | No | Complete path to input file including filename and extension (e.g., '/path/to/input.md') | |
| output_file | No | Complete path where to save the output including filename and extension (required for pdf, docx, rst, latex, epub, odt, pptx formats) | |
| input_format | No | Source format of the content (defaults to markdown) | markdown |
| defaults_file | No | Path to a Pandoc defaults file (YAML) containing conversion options. Similar to using pandoc -d option. | |
| output_format | No | Desired output format (defaults to markdown). Note pptx is write-only: it can be produced but not read. | markdown |
| reference_doc | No | Path to a reference document to use for styling. Supported for docx, odt and pptx output. The file must match the output format: a .docx reference for docx output, .odt for odt, .pptx for pptx. |