md2html Synopsis


md2html Synopsis


Everything md2html can do, on one page: what to write, and what it does, one feature per line. md2html turns Markdown into web pages, one file or a whole tree of them; the CGI (cgi/CGI.markdown.rex) serves the same pages from a web server, as they are asked for. They share almost everything, and the last section says where the CGI differs. Each group ends with a link to the md2html 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.

The Command Line

[rexx] md2html [options] file.md [destination]
[rexx] md2html [options] folder [destination]
Write What it does
md2html file.md Writes file.html in the current folder, or in destination. .md may be left out.
md2html folder Every .md file in the folder and below it, into the same tree under destination (the current folder by default).
--plain The document alone, with its style sheets: no page around it (no Bootstrap layout, header, sidebar, footer or style chooser). The way to look at a README in a browser.
--style dark, --style my-style.css The Rexx colours of the page, over the front matter's style:. A name that is not a shipped style is an error.
--default "attributes" Attributes for every Rexx fence, as if written on each (--default "executor"). style= here pins every block: the chooser leaves them alone.
-c cssbase, -j jsbase Where the page finds its style sheets and scripts. By default, a css/ and a js/ folder in the destination; without them, https://rexx.epbcn.com/rexx-parser/.
-p path The first folder to look in for default.md2html and md2html.custom.rex.
--continue In a folder, go on when a Rexx block does not parse.
-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. md2html needs Pandoc.

→ Usage, Options

The Page Around the Document

Write What it does
default.md2html The template of every page: Bootstrap 3, the header, the sidebar, the footer, the style chooser. Its markers (%title%, %contents%, %header%…) are filled in; lines that start with -- are comments.
md2html.custom.rex Routines that write the header, content header, sidebar and footer, skip files (md2html.Exception), rename them (md2html.TranslatedName; the sample's routine is misnamed today, md2html.TranslateFilename, so its renaming does not run), choose the extension and the class sheet.
Both, searched In the -p folder, the current folder, the destination, the source folder (in a folder run), then where Rexx finds programs. Both are in bin/ as samples; the sample header carries a "Sample layout — customize me" notice.
file.md.css next to file.md A print sheet for that page alone (running heads and the like).
The first # heading The page's title.
lang: es The page's language (<html lang>), and of the labels: "Listado 1".

Pandoc reads the text with its "smart" punctuation off: --- and -- stay as they are typed, and so do straight quotes. Write — and – directly.

→ Program operation, Markers, md2html.custom.rex, CSS and JavaScript, Print styles

The Style Chooser

Write What it does
style: tokio-day The Rexx colours the page starts with (default dark), for a reader who has not chosen one. --style wins.
style: my-style.css A style sheet of your own, next to the document: linked where it is, and offered by the chooser.
(nothing) A page with Rexx blocks shows a chooser of every shipped style; the reader's choice is remembered by the browser.
?style=light in the address That style, for this visit, without changing what the reader chose.
style= on a fence That block keeps its style, whatever the chooser says.

On a page with a class look (below) and Rexx blocks, the bar also has a Print button. It asks for ?print=pdf, which only the CGI answers.

→ YAML front matter

Document Classes

md2html does not read docclass:. The sample md2html.custom.rex gives a class look by the file's name: article.md, book.md, letter.md and slides.md get the screen side of that class's sheet; any other name, the plain Markdown look.

Write What it does
::::: title-page … ::::: The title page, with ::: author, affiliation, address, email, phone, date. A subtitle goes in <small> in the title.
::::: epigraph with ::: cite and ::: attribution An epigraph.
>, ::: quote, ::: quotation, ::: noindent Quotations, short and long; paragraphs with no indent.
::::: sender, date, recipient, opening, closing, signature, enclosure, cc The parts of a letter (letter.md).
{.part}, {.chapter} on a heading Parts and chapters (book.md).
{.newpage} on a heading or a ::: A page break, when a page with a class look is printed.
{.unnumbered} on a heading No number for that heading.

These classes are drawn for paper by md2pdf; md2html shows them on a screen, in one long page.

→ The article class, The book class, The letter class, Quotations, Epigraph

Rexx Code

Write What it does
```rexx A Rexx listing, highlighted by the Rexx Parser. The fence and its attributes are caseless: ```REXX {.numberlines} works.
```executor, executor, experimental, unicode (or tutor), cms (or rexxvm) The dialects, on the fence. executor: yes… under rexxpub:: 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=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.

A wide listing gets a horizontal scroll bar.

→ Fenced Code Blocks

Rexx in Prose

Write What it does
`Say "Hi"`{.rexx} Rexx in a sentence, highlighted in the page's style.
`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: tango chooses its 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; without the file, its own text stays.
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)

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. indent, clear and hide are left alone; marks on prose, tables and pictures are md2slides' only.

→ 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 Pandoc's tables, balanced: the columns are as wide as what they hold, not as the dashes say. A line above, below, and under the head.
::: {.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.
Code in a grid-table cell A fence there is a listing.

→ Tables, Table options

Figures, Notes and References

Write What it does
![The caption](pic.png) A figure with its caption below: "Figure 1: The caption". The picture is linked, not copied.
number-figures: no Captions with no "Listing N" or "Figure N".
listings:, figures: How captions look: caption-position, caption-style, label-style, label: Example.
section-numbers: 2 Sections numbered two levels deep (0: none). By default 3, but 2 in book.md and none in slides.md and letter.md.
chapter: 3 The page is chapter 3: its first heading is not numbered, the others are 3.1, 3.1.1…
[^1] and [^1]: The note. A footnote, at the end of its section.
{#intro} on a heading, [see](#intro) A link to it; its text is what you write.
[@knuth], bibliography: (or references:), ::: {#refs} Citations, linked to the list, in the style of csl:, or rexxpub (the csl/ folder) without it.
::: {#toc} Stays empty in md2html. The CGI fills it.

→ Listing options, Figure options

The Front Matter

Key What it does
lang:, highlight-style:, bibliography:, csl: (outside rexxpub:) The language of the page and the labels; the colours of code that is not Rexx; the references and their style.
style: The Rexx colours (dark); --style wins.
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.

md2html does not read docclass:, size:, margin:, css: or outline:. Invalid YAML stops the build, with its line. 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

The CGI

cgi/CGI.markdown.rex runs under Apache: every .md file is turned into a page when it is asked for, never stored. readme.md, article.md, book.md, letter.md and slides.md serve as a folder's index. It reads the same Markdown as md2html, with these differences.

Write What it does
?style=light That shipped style. A name with no css/rexx-NAME.css gives a 404.
?print=pdf The page laid out in pages by paged.js, in the browser, to print as a PDF: footnotes at the foot of the page, numbered on. Here quotes and dashes are typographic (smart punctuation), as in md2pdf.
file.rex?view=highlight, file.cls?view=highlight A Rexx program highlighted; without it, as plain text.
Any other parameter A 404.
docclass: article Read: article, book, letter or slides, whatever the file's name.
size: 10 Read: 10, 11, 13 or 14, in the classes that have a sheet for it (article, book, letter).
bibliography:, [@knuth], ::: {#refs} Citations work. The style is csl: in the front matter; without it, Pandoc's own (Chicago author-date).
::: {#toc} Filled with links to the headings; in a book under ?print=pdf, with page numbers.
style: A shipped style only, not a file of your own: the page opens in it, unless ?style= or the reader's choice says otherwise.
executor: yes… under rexxpub: Not read: write the dialect on the fence.
Any other file name The plain Markdown look, and no section numbers unless section-numbers: says so.

The CGI has none of md2html's options (--plain, --default…) and does not report names in the wrong case. Its header, sidebar and footer come from rexx.epbcn.com.optional.cls.

→ CGI Installation, The CGI Program, Comparison with the CGI program