npm run build — generate dist filesnpm test — run testsnpm test -- --coverage — run tests with coverage reportnpm run test:compat — run compatibility tests (Deno + Bun) from compat-test/The compiler has two stages:
src/parser.ts) — regex-based recursive descent parser, produces ASTsrc/html.ts) — produces HTML string from the ASTAST node shapes live in src/ast.ts. Every node has a type field. Block nodes use body (for inline content) or doc (for nested blocks). Text content uses txt. AST is plain JSON-serializable data — no classes, functions, or circular references.
Parser and renderer are both stateless and side-effect free.
Parser uses two rule types:
SimpleRule — single regex matchLookaheadRule — pre-match regex determines the main regex (used for lists)Rules are matched in priority order; first match wins.
transformBlock and transformInline hooks allow AST modification without forking the parser. See EXTENDING.md for usage and conventions.
See LiteMarkup-syntax.lm for the syntax description. It should be kept in sync with this reference implementation.
regex101.com is great for developing the regexes.
Avoid backtracking — match as little as possible, but not too little.
compat-test/Add a failing test first for parser/renderer changes. Re-run the suite after changes.
npm run testnpm run test:compatnpm run buildnpm version patch|minor|majorjsr.json to match package.jsongit push --tagsnpm publishnpx jsr publish