md2pdf Synopsis


md2pdf Synopsis


Everything md2pdf can do, on one page: what to write, and what it does, one feature per line. md2pdf turns Markdown into a PDF: Pandoc makes an HTML page with every style sheet inside it, and pagedjs-cli (paged.js in a headless Chromium) lays it out in pages, in one of four document classes: article, book, letter and slides. Each group ends with a link to the md2pdf manual or to the pages of the classes, which tell the whole story. Which of these features the other md2 programs share is in the table of features; every key of the front matter is in The Front Matter at a Glance.

This page describes the programs of 2 November 2026.

The Command Line

[rexx] md2pdf [options] file.md
[rexx] md2pdf [options] folder [destination]
Write What it does
md2pdf article Writes article.pdf next to article.md. .md may be left out.
md2pdf folder Every .md file in the folder and below it; each PDF next to its file, or in the same tree under destination.
--style print, --style my-style.css The Rexx colours, over the front matter's style: (default dark).
--default "attributes" Attributes for every Rexx fence, as if written on each.
-xtr, -exp, -u Executor, Experimental, Unicode (TUTOR) for every listing.
--csl ieee, --csl styles/my.csl The citation style: a name in the csl/ folder, or a file (default rexxpub).
--pandoc-highlighting-style tango The colours of code that is not Rexx (default pygments).
-c folder Another css/ folder, with the same inside: bootstrap.css, flattened/, print/.
--fix-outline The PDF opens with its outline shown. Needs Python and pikepdf.
--continue In a folder, go on when a file fails; the summary counts the failures.
--check-deps Checks Pandoc, Node.js, npm and pagedjs-cli.
-it, -h The internal traceback on an error; the help.

The size, the class, the numbering and the language are not on the command line any more: they go in the front matter. In one file, a Rexx block that does not parse is printed as its error message, and the run goes on; in a folder it stops the run, unless --continue. A class or a key that is ours but for its case (.numberlines) is reported, with its line.

→ Usage, Options, Prerequisites

Document Classes

Write What it does
A file named article.md, book.md, letter.md, slides.md That class. Any other name: the default class.
docclass: book That class, whatever the name. A class with no sheet in css/print/ is reported and left out.
article A4, 3 cm margins, Times, justified and hyphenated, indented paragraphs. Page numbers at the foot, in the centre; none on the first page.
book Facing pages: 3.5 cm inside, 2.5 cm outside. Running heads: the book's title on the left page, the chapter's on the right. Page numbers in the outer corner.
letter A4, 2.5 cm margins, ragged right, no indent. Page numbers from page 2.
slides 16:9 pages (254 × 142.875 mm), 20 pt sans serif, a coloured title bar. The title at the foot on the left, the slide number on the right; neither on the first slide.
default A4, 3 cm margins, block paragraphs. Page numbers at the foot, in the centre; none on the first page.

The PDF's title (in its properties) goes by the class: the first heading in an article, a book or slides; "Letter to" and the recipient in a letter; the file's name in any other class.

→ The article class, The book class, The letter class, The slides class, The Common Core

The Structure of a Document

Write What it does
::::: title-page … ::::: The title page: the title (a # heading), and ::: author, affiliation, address, email, phone, date. In slides, event and venue too.
Title <small>Subtitle</small> A subtitle (in italics, except in a book).
[The Book]{.book-title} in the title The book's title for the running heads.
::: abstract Its headings are not numbered. It has no look of its own, and ::: keywords neither.
{.part} on a heading A part: a new page, numbered I, II… when sections are numbered. In a book, a page of its own on the right, with no running heads and no page number.
{.chapter} on a heading A chapter, numbered 1, 2…, its sections 1.1, 1.2… In a book, on a right-hand page, its title in the running head.
{.slide} on a heading A new slide, the heading its title. {.section} (or {.part}): a section divider, centred.
::::: closing-page The closing slide, centred.
::::: sender, date, recipient, opening, closing, signature, enclosure, cc The parts of a letter.
::: {#toc .toc-exclude} with ## Contents {.toc-exclude} A table of contents of the levels 1 to 3; page numbers in a book. .toc-exclude keeps a heading out.
{.newpage} on a heading or a ::: A new page. ({.section} and {.part} start one too, in every class.)
{.unnumbered} on a heading No number for that heading.
::::: epigraph with ::: cite and ::: attribution An epigraph: the quotation smaller and indented, the credit on the right.
> or ::: quote; ::: quotation A short quotation; a long one, every paragraph but the first indented. Italic in a letter, with a bar in slides.
::: noindent Paragraphs with no first-line indent.

→ Epigraph, Quotations, Chapters and parts, The table of contents, Running headers

The Page

Write What it does
size: 10 The text size: 10, 11, 13 and 14 have sheets of their own, made after LaTeX; 12 is the base; any other size from 6 to 36 (9, 10.5, 9pt) is worked out from the nearest. slides has one size.
margin: 2cm, margin: 2cm 1.5cm The margins, as in CSS: 1 to 4 lengths (cm, mm, in, pt, pc, px, q). In a book, the sides are outside and inside.
css: mine.css, css: [a.css, "my sheets/b.css"] Sheets of your own, relative to the document, after RexxPub's.
file.md.css next to file.md A sheet for that file alone, after those.
outline: 4 The PDF's outline (bookmarks) from h1 to h4: up to 6, default 3. outline: 0: no outline.
section-numbers: 2 Sections numbered two levels deep (0: none). By default 3, 2 in a book, none in a letter or slides.
chapter: 3 The document is chapter 3: its first heading is not numbered, the others are 3.1, 3.1.1…
lang: es The PDF's language, that of the labels ("Listado 1", "Figura 1") and of hyphenation.

Words are hyphenated by the rules of lang:. Pandoc's "smart" punctuation is on: --- is an em dash, -- an en dash, and quotes curl.

→ YAML front matter, RexxPub options

Rexx Code

Write What it does
```rexx A Rexx listing, highlighted by the Rexx Parser. The fence and its attributes are caseless. A listing is kept on one page.
```executor, executor, experimental, unicode (or tutor), cms (or rexxvm) The dialects, on the fence. executor: yes… under rexxpub:, or -xtr…: for every listing.
.numberLines, startFrom=97, numberWidth=4 Line numbers, from 97, at least 4 wide.
caption="Hello" A caption above the listing: "Listing 1: Hello".
.blanks, blanks=all The blanks that are data, or all of them, drawn as open boxes; a tab, as an arrow.
source=hello.rex The listing read from a file, relative to the document.
program=hanoi on each piece Pieces of one program, highlighted as one, their lines numbered on.
style=light, size=8pt This block's colours; its font size.
pad=, patch=, patchfile=, doccomments=, extraletters=… The other options of the Rexx Highlighter.
```jdor A JDOR drawing, as SVG.
A fence in a grid-table cell Highlighted there too.

→ Fenced Code Blocks

Rexx in Prose

Write What it does
`Say "Hi"`{.rexx} Rexx in a sentence, highlighted.
`End`{.rexx variable}, {.rexx method}, {.rexx class}, {.rexx expression}… What the words are, when the span alone does not say.
[USE]{.kw} A keyword: the same as `USE`{.rexx keyword}.
`Say A B`{.rexx .blanks} The blanks shown.
mentions: background: none Rexx in sentences in the style's colours, on no ground.

→ Inline Rexx, Mention options

Other Code and Output

Write What it does
```python, ```bash… Highlighted by Pandoc; highlight-style: or --pandoc-highlighting-style chooses the colours.
```output What a program printed: a plain block, with no look of its own.
`3 4`{.output} Output in a sentence: shown as code.
.numberLines, startFrom= Line numbers, by Pandoc.
caption="…" A caption, as on a Rexx listing, on ```output too.
source=out.txt The block read from a file.
blanks=all, .blanks The blanks drawn. The block loses its language's colours; it keeps its line numbers.
listings: frame: tb A frame round the blocks that Pandoc highlights: tb, single, leftbar.

→ Tables (and blocks), in md2html

Marks

On a page every mark is there at once: there are no steps.

Write What it does
spot="init:2 loop:5-7,9" on a fence Marks lines 2, and 5 to 7 and 9: two beats, init and loop, each in a pen of its own.
spot="t:[NOVALUE]", spot="t:5[ANY:]" That text wherever it is in the block; only on line 5. Whole words.
caseless, part The text in any case; inside words too.
wash, ink, box, ring, bold How the marks look (wash is the default). hatch is drawn as a wash.
pen=2, pen=#c00, pen=navy One of the style's four pens, or a colour.
spot= on output or other code Marked the same way; the block loses its language's colours, and keeps its line numbers.

A beat takes its pen by its place in the page: the first beat pen 1, the second pen 2, and a beat that comes back in another block keeps its colour.

→ spot=

Grounds and Frames

Write What it does
background=lightyellow on any fence The block's ground: a colour, or none.
border=dashed, border-width=0.5pt, border-color=gray A frame: solid, dashed, dotted, none. A width or a colour alone means solid.
blocks: in the front matter The same for every block, under code:, output:, other: (code that is not Rexx) or one language (bash:, rexx:; v366). The fence wins.
#RRGGBB, #RGB, cornflowerblue The colours: hex, or the 148 names of CSS.

→ Block options, background=

Tables

Write What it does
Pipe, simple, multiline and grid tables Balanced: the columns are as wide as what they hold, not as the dashes say. Rules above, below, and under the head, as in LaTeX's booktabs.
::: {.table cols=1:3} around a table The proportions of its columns.
.grid, .stripes, stripes=#E8F0FF on the ::: A line round every cell; every second row on grey, or on that colour. .nogrid, .nostripes: not for this one.
tables: grid: yes, stripes: yes The same for every table.
scale=0.85 on any ::: or [span] Its text and code that much smaller; scales multiply when they nest.

→ Table options

Figures, Notes and References

Write What it does
![The caption](pic.png) A figure with its caption below: "Figure 1: The caption". A relative path is from the folder of the .md.
number-figures: no Captions with no "Listing N" or "Figure N". Listings and figures count apart.
listings:, figures: How captions look: caption-position, caption-style, label-style, label: Example.
[^1] and [^1]: The note. A footnote, at the foot of its page.
{#intro} on a heading, [see](#intro) A link to it; its text is what you write.
bibliography: refs.bib, [@knuth] Citations, linked to the list.
::: {#refs} Where the list of references goes.

csl: my.csl in the front matter is the citation style, and wins over --csl (whose default is rexxpub).

→ Listing options, Figure options, Program operation

The Front Matter

Key What it does
lang:, highlight-style:, bibliography: (outside rexxpub:) The language; the colours of code that is not Rexx; the references.
style: The Rexx colours (dark); --style wins.
docclass:, size:, margin:, css:, outline: The class, the size, the margins, sheets of your own, the outline.
section-numbers:, number-figures:, chapter: Numbering.
listings:, figures: Captions.
tables:, blocks:, mentions: Tables; grounds and frames; Rexx in sentences.
executor:, experimental:, unicode:, tutor: The dialect of every listing.

Invalid YAML stops the build, with its line; a value of the wrong shape is reported and left out. Every key, with its values and the other programs that read it, is in The Front Matter at a Glance.

→ YAML front matter, YAML Front Matter