Guides
Pipeline
Nizel processes content in a predictable order.
Steps
resolve options
extract frontmatter
render frontmatter templates
render body templates
run beforeParse hooks
parse Markdown to AST
run AST transforms
render AST to output format
run afterRender hooks
collect metadata (toc, headings, links, images)
build result object
Detail
1. Resolve Options
Merge constructor options with runtime options. Runtime options win on conflict.
2. Extract Frontmatter
If frontmatter: true, Nizel looks for a leading --- block and parses it as YAML. The frontmatter is removed from the Markdown body before parsing continues.
3. Render Frontmatter Templates
Template expressions like {{ value }} inside frontmatter values are resolved using the provided variables.
4. Render Body Templates
Template expressions inside the Markdown body are resolved.
5. Before Parse Hooks
Plugins with beforeParse hooks run. These can modify the raw Markdown string.
6. Parse Markdown
The Markdown body is parsed into an AST. This is the core parsing step that handles block structure, inline content, and nested elements.
7. AST Transforms
Plugins with transform hooks receive the AST and can modify it before rendering.
8. Render
The AST is rendered to the output format (HTML by default).
9. After Render Hooks
Plugins with afterRender hooks run. These can modify the rendered output.
10. Collect Metadata
Headings, links, images, reading time, excerpt, and table of contents are collected.
11. Build Result
All collected data is assembled into the final result object.