The -D option in Pandoc is used to dump default data files or templates for specific formats. The valid parameters for -D correspond to supported output formats (writers) and certain special data files. Here's a breakdown:
1. Writers (Output Formats)
These are the primary parameters for -D. Use any writer listed in pandoc --list-writers to dump its default template. Examples include:
pandoc --list-writers
Common writers:
html, html5, html4
latex, beamer
context, pdf (via LaTeX)
docx, odt, rtf, opendocument
epub, epub3
markdown, markdown_github, commonmark
rst, asciidoc
org, texinfo, man, plain, native
Example:
pandoc -D latex > default.latex # Dump LaTeX template
pandoc -D docx > reference.docx # Generate reference.docx for DOCX output
2. Special Data Files
Some formats require additional data files. Use these specific identifiers:
| Parameter | Purpose | Example Command |
|---|
html_css | Default CSS for HTML output | pandoc -D html_css > style.css |
epub_css | Default CSS for EPUB output | pandoc -D epub_css > epub.css |
epub_fonts | Font files for EPUB | pandoc -D epub_fonts > fonts.txt |
reference_docx | Reference DOCX for styling | pandoc -D docx > reference.docx |
reference_odt | Reference ODT for styling | pandoc -D odt > reference.odt |
3. How to Use
To dump a template/data file:
pandoc -D <format> > output-file
Examples:
4. Notes
- PDF: Use
latex as the parameter (pandoc -D latex) since PDF output relies on LaTeX.
- Customization: Modify dumped templates/data files and use them with Pandoc via
--template, --css, or --reference-doc.
- List Writers: Run
pandoc --list-writers to see all valid writer names for -D.
This approach ensures you can customize Pandoc's output by overriding default templates or styles.