Everything md2epub can do, on one page: what to write, and what it does, one feature per line. md2epub turns Markdown into an EPUB ebook: the Rexx listings are highlighted first, and then Pandoc writes the book, with the style sheets of the highlighting inside it. The reader lays out the pages, so there are no document classes, and some of what md2html and md2pdf do is not done here: the last section says what. Each group ends with a link to the md2epub manual, which tells 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.
[rexx] md2epub [options] file.md
[rexx] md2epub [options] folder [destination]
| Write | What it does |
|---|---|
md2epub book |
Writes book.epub next to book.md.
.md may be left out. |
md2epub folder |
Every .md file in the folder and below it; each EPUB
next to its file, or in the same tree under destination. |
--cover cover.jpg |
The cover picture (JPEG or PNG), relative to the document's folder. A file that is not there is reported, and the book has no cover. |
--chapter-level 2 |
Where the book is cut into chapters: at every level-2 heading
(1 to 6; default 1). Use 2 when #
headings are parts. |
--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; md2epub takes the
flattened/ sheets, as ebook readers do not understand
nested CSS. |
--continue |
In a folder, go on when a file fails; the summary counts the failures. |
-it, -h |
The internal traceback on an error; the help. |
In one file, a Rexx block that does not parse is shown 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. md2epub needs
Pandoc, and nothing else.
| Write | What it does |
|---|---|
| The first level-1 heading | The book's title, without its <small> subtitle:
the first line of the file that starts with # (careful: a
# comment in the front matter or in a shell fence counts
too). Pandoc puts it on a title page of its own, before the text; a
title: in the front matter does not change it. |
author:, date:, abstract: at
the top of the front matter |
On Pandoc's title page, and in the book's data. |
# headings (or the level of chapter-level:
or --chapter-level) |
Each one starts a chapter. The reader's table of contents lists them. |
cover: cover.jpg, chapter-level: 2 under
rexxpub: |
As --cover and --chapter-level, which they
win over. |
section-numbers: 2 |
Sections numbered two levels deep. By default none: a book is not numbered unless it asks. |
lang: es |
The book's language, and that of the labels: "Listado 1", "Figura 1". |
::::: title-page, ::::: epigraph,
::: quote, {.part},
{.chapter}… |
Kept as blocks with those classes, but with no look of their own: the class sheets of md2pdf are not in the book. The title page comes after Pandoc's. |
{.newpage} |
Nothing: the reader decides the pages. |
::: {#toc} |
Stays empty: the reader has its own table of contents. |
Pandoc's "smart" punctuation is on: --- is an em dash,
-- an en dash, and quotes curl.
→ Differences from md2pdf, Program operation
| Write | What it does |
|---|---|
```rexx |
A Rexx listing, highlighted by the Rexx Parser. The fence and its attributes are caseless. |
```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. |
.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=0.8em |
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. |
caption="Hello" |
A caption above the listing: "Listing 1: Hello" (below with
listings: caption-position: below). |
| 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
| 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. |
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. |
→ Tables (and blocks), in md2html
In a book 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=
| 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. |
| 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. |
::: {.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. |
| Write | What it does |
|---|---|
 |
A figure, with its caption below: "Figure 1: The caption"; the picture goes into the book. |
number-figures: no |
Captions with no "Listing N" or "Figure N". |
listings: label:, caption-position:;
figures: label: |
The words of the labels, and the listing's caption above or below. |
[^1] and [^1]: The note. |
A footnote, at the end of its chapter, numbered from 1 in each chapter. |
{#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).
| 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. |
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
| Write | In an EPUB |
|---|---|
chapter: |
Not used. |
caption-style:, label-style: under
listings: or figures: |
Not used: the reader's own look. |
docclass:, size:, margin:,
css:, outline:, file.md.css |
Not used: the reader lays out the pages. |
listings: frame: |
Not used. |
| The style chooser | Not there: the colours are the ones the book was made with. |