plgg-md
v0.0.2
Published
A Markdown-to-typed-data parser built from scratch on the plgg framework: a layout-marker frontmatter splitter and a block tokenizer for the plggpress subset that produce an immutable Box-union AST (Result, never throw)
Readme
plgg-md
UNSTABLE - Experimental study work. Part of the plgg monorepo.
A Markdown-to-typed-data parser, built from scratch on
plgg. A layout-marker frontmatter splitter and a
block tokenizer for the plggpress Markdown
subset produce an immutable Box-union AST — a Result,
never a throw. It underpins plggpress content parsing.
Why this package exists
plggpress needs Markdown as data it can render through
plgg-view, not as an opaque HTML string.
plgg-md parses source text into a typed tree so the render
step is a pure fold:
plgg ── plgg-md ── plggpress
└── renders to plgg-view HtmlHow it's organized
- Frontmatter — the layout-marker splitter that peels a page's frontmatter off its body.
- Block — the block tokenizer that turns the body into the
Box-union AST (headings, lists, fenced code, …). - Inline — inline-span tokenizing within a block.
- Render — folds the AST into a
plgg-viewHtmltree.
Because the AST is a Box union and every step returns a
Result, malformed input is a value to handle, not an
exception.
Conventions
as/any/ts-ignoreare prohibited (see rootCLAUDE.md); the parser narrows with plgg type guards,Option, andResult.- After editing
plggorplgg-viewcore, rebuild itsdistor this package won't see new exports.
