01 · read
Blocks first, then inlines
A line opens a container or closes one; what is left over is read for emphasis, links, code spans and entities. The pairing rules are the ones in the specification, not an approximation of them.
a markdown reader
CommonMark 0.31.2 and GitHub Flavored Markdown for MoonBit. A document becomes blocks and inlines you can walk, renders as HTML or as Markdown again, and can be read a chunk at a time while it is still being written.
moon add moonbitstack/moonmd
read the guide
commonmark 0.31.2 tables, strikethrough, autolinks, task lists, footnotes, tag filter native, js, wasm, wasm-gc
the workbench
Everything below is this library compiled to JavaScript: the same parser, the same renderer, no second implementation. Type in the left column; the right one follows.
what it does
01 · read
A line opens a container or closes one; what is left over is read for emphasis, links, code spans and entities. The pairing rules are the ones in the specification, not an approximation of them.
02 · write
Raw HTML is escaped and a destination that would run script keeps its text and loses its link. Pass safe=false to reproduce the specification's output byte for byte.
03 · return
The same tree writes itself out as Markdown that reads back to the same HTML: fences grow to clear their contents, text that would start a block is escaped.
04 · stream
feed returns the blocks no later text can change, finish the rest. A chunk may end anywhere, including in the middle of a line.
the figures
counted from the example sets the package carries, not typed by hand.
read on