:PROPERTIES: :ID: 75ea690d-deee-4592-ae99-1c2385c208fb :END: #+title: pandoc #+filetags: :linux: Pandoc is a converter tool written in Haskell. Files can be converted from the [[id:d71414fc-349c-4763-a703-9f7092fc90d6][command-line]]. It is a part of the [[id:f68dfc34-5349-42d1-8074-6c4be231a69b][org-web-tools]] but can also be used as a standalone programme. * [[https://pandoc.org/demos.html][Pandoc - Demos]] :website: [2023-03-04 Sa 10:28] You can try pandoc online [[http://johnmacfarlane.net/pandoc/try][here]]. *** Examples To see the output created by each of the commands below, click on the name of the output file: 1. HTML fragment: #+begin_example pandoc MANUAL.txt -o example1.html #+end_example 2. Standalone HTML file: #+begin_example pandoc -s MANUAL.txt -o example2.html #+end_example 3. HTML with table of contents, CSS, and custom footer: #+begin_example pandoc -s --toc -c pandoc.css -A footer.html MANUAL.txt -o example3.html #+end_example 4. [[id:345d5300-432c-4f6f-98a4-4527e955927f][latex]]: #+begin_example pandoc -s MANUAL.txt -o example4.tex #+end_example 5. From LaTeX to markdown: #+begin_example pandoc -s example4.tex -o example5.text #+end_example 6. reStructuredText: #+begin_example pandoc -s -t rst --toc MANUAL.txt -o example6.text #+end_example 7. Rich text format (RTF): #+begin_example pandoc -s MANUAL.txt -o example7.rtf #+end_example 8. Beamer slide show: #+begin_example pandoc -t beamer SLIDES -o example8.pdf #+end_example 9. DocBook XML: #+begin_example pandoc -s -t docbook MANUAL.txt -o example9.db #+end_example 10. Man page: #+begin_example pandoc -s -t man pandoc.1.md -o example10.1 #+end_example 11. ConTeXt: #+begin_example pandoc -s -t context MANUAL.txt -o example11.tex #+end_example 12. Converting a web page to markdown: #+begin_example pandoc -s -r html http://www.gnu.org/software/make/ -o example12.text #+end_example 13. From markdown to PDF: #+begin_example pandoc MANUAL.txt --pdf-engine=xelatex -o example13.pdf #+end_example 14. PDF with numbered sections and a custom LaTeX header: #+begin_example pandoc -N --variable "geometry=margin=1.2in" --variable mainfont="Palatino" --variable sansfont="Helvetica" --variable monofont="Menlo" --variable fontsize=12pt --variable version=2.0 MANUAL.txt --include-in-header fancyheaders.tex --pdf-engine=xelatex --toc -o example14.pdf #+end_example 15. ipynb (Jupyter notebook): #+begin_example pandoc example15.md -o example15.ipynb #+end_example 16. HTML slide shows: #+begin_example pandoc -s --mathml -i -t dzslides SLIDES -o example16a.html #+end_example #+begin_example pandoc -s --webtex -i -t slidy SLIDES -o example16b.html #+end_example #+begin_example pandoc -s --mathjax -i -t revealjs SLIDES -o example16d.html #+end_example 17. TeX math in HTML: #+begin_example pandoc math.text -s -o mathDefault.html #+end_example #+begin_example pandoc math.text -s --mathml -o mathMathML.html #+end_example #+begin_example pandoc math.text -s --webtex -o mathWebTeX.html #+end_example #+begin_example pandoc math.text -s --mathjax -o mathMathJax.html #+end_example #+begin_example pandoc math.text -s --katex -o mathKaTeX.html #+end_example 18. Syntax highlighting of delimited code blocks: #+begin_example pandoc code.text -s --highlight-style pygments -o example18a.html #+end_example #+begin_example pandoc code.text -s --highlight-style kate -o example18b.html #+end_example #+begin_example pandoc code.text -s --highlight-style monochrome -o example18c.html #+end_example #+begin_example pandoc code.text -s --highlight-style espresso -o example18d.html #+end_example #+begin_example pandoc code.text -s --highlight-style haddock -o example18e.html #+end_example #+begin_example pandoc code.text -s --highlight-style tango -o example18f.html #+end_example #+begin_example pandoc code.text -s --highlight-style zenburn -o example18g.html #+end_example 19. GNU Texinfo, converted to info and HTML formats: #+begin_example pandoc MANUAL.txt -s -o example19.texi #+end_example #+begin_example makeinfo --no-validate --force example19.texi -o example19.info #+end_example #+begin_example makeinfo --no-validate --force example19.texi --html -o example19 #+end_example 20. OpenDocument XML: #+begin_example pandoc MANUAL.txt -s -t opendocument -o example20.xml #+end_example 21. ODT (OpenDocument Text, readable by OpenOffice): #+begin_example pandoc MANUAL.txt -o example21.odt #+end_example 22. MediaWiki markup: #+begin_example pandoc -s -t mediawiki --toc MANUAL.txt -o example22.wiki #+end_example 23. EPUB ebook: #+begin_example pandoc MANUAL.txt -o MANUAL.epub #+end_example 24. Markdown citations: #+begin_example pandoc -s --bibliography biblio.bib --citeproc CITATIONS -o example24a.html #+end_example #+begin_example pandoc -s --bibliography biblio.json --citeproc --csl chicago-fullnote-bibliography.csl CITATIONS -o example24b.html #+end_example #+begin_example pandoc -s --bibliography biblio.yaml --citeproc --csl ieee.csl CITATIONS -t man -o example24c.1 #+end_example 25. Textile writer: #+begin_example pandoc -s MANUAL.txt -t textile -o example25.textile #+end_example 26. Textile reader: #+begin_example pandoc -s example25.textile -f textile -t html -o example26.html #+end_example 27. [[id:66d0f2d2-f2ea-4ab6-af2c-fefaaab755a5][org-mode]]: #+begin_example pandoc -s MANUAL.txt -o example27.org #+end_example 28. AsciiDoc: #+begin_example pandoc -s MANUAL.txt -t asciidoc -o example28.txt #+end_example 29. Word docx: #+begin_example pandoc -s MANUAL.txt -o example29.docx #+end_example 30. LaTeX math to docx: #+begin_example pandoc -s math.tex -o example30.docx #+end_example 31. DocBook to markdown: #+begin_example pandoc -f docbook -t markdown -s howto.xml -o example31.text #+end_example 32. MediaWiki to html5: #+begin_example pandoc -f mediawiki -t html5 -s haskell.wiki -o example32.html #+end_example 33. Chunked HTML: #+begin_example pandoc -t chunkedhtml --split-level=2 --toc --toc-depth=2 --number-sections -o example33 MANUAL.txt #+end_example 34. Docx with a reference docx: #+begin_example pandoc --reference-doc twocolumns.docx -o UsersGuide.docx MANUAL.txt #+end_example 35. Docx to markdown, including math: #+begin_example pandoc -s example30.docx -t markdown -o example35.md #+end_example 36. EPUB to plain text: #+begin_example pandoc MANUAL.epub -t plain -o example36.text #+end_example 37. Using a template to produce a table from structured data: #+begin_example pandoc fishwatch.yaml -t rst --template fishtable.rst -o fish.rst # see also the partial species.rst #+end_example 38. Converting a bibliography from BibTeX to CSL JSON: #+begin_example pandoc biblio.bib -t csljson -o biblio2.json #+end_example 39. Producing a formatted version of a bibliography: #+begin_example pandoc biblio.bib --citeproc --csl ieee.csl -s -o biblio.html #+end_example