ssh git@grit.deadkey.org man

mailmanpat/markdown.awk · 2026-09-05 17:01:23 +08002026-9-5 +8git clone …

FILES / README.md

NameLast CommitTimestampSize
test e8441ae h Let a thematic break end a quoted paragraph 26-09-05 17:01 -
README.md 6b66487 h Extract the markdown parser from jenny 26-09-05 09:57 1 KB
markdown.awk e8441ae h Let a thematic break end a quoted paragraph 26-09-05 17:01 35 KB

markdown.awk

A markdown-to-HTML parser in a single awk script. No build step, no runtime, no dependencies beyond an awk and a shell — it runs anywhere those do.

Use

awk -f markdown.awk < input.md > output.html

Nothing is configurable by flag; the parser reads markdown on stdin and writes HTML on stdout.

What it renders

Headings (with slugged ids), paragraphs (with content-derived ids for deep links), emphasis and strong, inline and fenced code, links and autolinks, images, lists including nested ones, tables, blockquotes, horizontal rules, strikethrough, footnotes, citations, MultiMarkdown metadata blocks, and fenced diagram blocks left raw for a client-side renderer.

Deliberately unsupported: anything requiring a second pass over the document, or configuration. The parser is one stream, one direction.

Tests

test/run.sh

Plain bash, no framework. test/units.sh covers the parsing rules; test/regressions.sh holds one case per bug the parser has had, with the reasoning in the comment above each.

Licence

Same terms as the project it was extracted from.