Pandoc Markdown



With Pandoc, it is possible to use a CSS stylesheet while converting Markdown to HTML. Tppc cheats.

Pandoc example.md -o example.pdf -from markdown -template eisvogel -listings where example.md is the markdown file you want to convert to PDF. In order to have nice headers and footers you need to supply metadata to your document. Pandoc is the primary tool that we use for converting Markdown into other formats. LaTeX is a typesetting system designed for the production of technical and scientific documentation. Pandoc requires LaTeX installation for creating PDF documents. We can install them from their respective websites, Pandoc and LaTeX.

This is the basic format of the command:

Assuming you have the custom CSS ready. If not, one possibility is to use a classless CSS stylesheet. I came accross MVP.css recently and liked how it looked.

To use MVP.css for documenting a project I’m working on, I had to make some modifications to Pandoc’s default HTML template. These are the steps I followed.

First, I saved the default template to a file:

Pandoc markdown to latex

And then, made the following changes in template.html:

Pandoc Markdown To Pdf

  • Move TOC to a dropdown menu in site navigation
  • Add a button with a link to the project website
  • Update colour scheme using CSS variables and made some minor adjustments to styles
Pandoc markdown docx

After adding some YAML metadata 1 to README.md, I ran pandoc again with the modified template and CSS file to generate the final output:

Pandoc Markdown To Html

Pandoc Markdown

You can get the modified template, MVP.css, a Makefile, and input and output files from this repository on GitLab.

Pandoc Markdown Title

These links might be useful:

Pandoc Markdown To Google Docs

  • Pandoc home page
  • Pandoc usage examples
  • Pandoc documentation on templates
  • I also like the Sakura stylesheet
  • More classless css stylesheets

Pandoc Markdown Docx

  1. Otherwise these variables will need to be provided on the command line. ↩