ssh git@grit.deadkey.org man

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

Recent Commits

TimestampCommitMessageAuthorN+-
26-09-05 17:01 e8441ae h Let a thematic break end a quoted paragraph Pat Ambrosio 2 +72 -3
26-09-05 10:46 ba20446 h Fold the probe after each decode, not only before the first Pat Ambrosio 2 +57 -6
26-09-05 10:29 9700190 h Decode percent escapes before deciding what scheme a URL holds Pat Ambrosio 2 +95 -9
26-09-05 10:19 e518a91 h Escape by default, and close the attribute and URL holes Pat Ambrosio 3 +185 -27
26-09-05 10:06 8cd72df h Cover images, rules, ordered lists, blockquotes and autolinks Pat Ambrosio 2 +103 -1
Total: 6 commits view full log

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.