What's this?

This is just a web page to convert Markdown into PDF. It does that using Pandoc and the EB Garamond 12, JetBrains Mono NL and Inter fonts. Pandoc and LaTeX generates super crisp PDF files. Before I used this approach I converted the Markdown to HTML, and used a web browser to "print" the page to a PDF file. For some reason the fonts are rendered more blurry when taking that route.

This web page is hosted on an old Raspberry Pi, so it is rather slow. Even though this is intended for my personal use, you are free to use it too.

More technical stuff: The LaTeX engine used is XeTeX, the site itself is built using Go.

The source code can be found here: https://github.com/EmasXP/mdpdf

The meta block

One can add a meta data block in the beginning of the Markdown source, like this:

---
Meta data goes here
---
The document starts here.

I've added a predefined meta data block that I believe works well for Markdown files (at least, this is how I personally think the Markdown files should look when printed on paper.)

Defining the title of the document

That is done using the title variable:

---
title: My document
---

Markdown title

Markdown files commonly use the H1 (# Title) for the document title. If that is the case, my suggestion is to use the title variable in the meta block instead. That way the title will be typeset in a larger font size.

A title is rendered in the center of the page, and has large top and bottom margins. Markdown files are commonly not rendered this way. If you want to make the title look more like a regular H1, add this to the meta block:

---
header-includes:
  - \usepackage{titling}
  - \setlength{\droptitle}{-3.88em}
  - \pretitle{\fontsize{21}{21}\selectfont\bfseries}
  - \posttitle{\par\vspace{-3.1em}}
---

This example will make the title more distinct than an ordinary H1, which is suitable for a document title.

Paragraph spacing

Vertical space is added between paragraphs by default. That can be changed to use indentation instead:

---
indent: true
---

Language of the document

To specify the language of the document, use the lang variable:

---
lang: en-GB
---

Hyphenation

To enable hyphenation, add the following to the meta block:

---
header-includes:
  - \usepackage[htt]{hyphenat}
  - \usepackage[hyphens]{url}
  - \usepackage{xurl}
---

This will also improve line breaking of URLs.

Code block line breaking

By default, code blocks do not break lines. To enable line breaking, add the following to the meta block:

---
header-includes:
  - \usepackage{fvextra}
  - \fvset{breaklines=true,breakanywhere=true}
---

Author and date

To add author and/or date, use the author and date variables:

---
author: Sam Doe
date: 24 October 2026
---

Removal of page numbers

When using pagestyle: empty, page numbers are removed. However, the first page will still have a page number. To remove that too, one can add the following:

---
header-includes:
  - \pagenumbering{gobble}
---

Document class

By default, the article document class is used. To change that, use the documentclass variable:

---
documentclass: scrartcl
---

Here are some common document classes:

The different document classes have different default behaviors, for example regarding chapter and section headings, but also margins, fonts, and more.

More variables

More variables are found here: https://pandoc.org/MANUAL.html#variables.

The mainfont and monofont and sansfont variables are hard-coded and cannot be changed.