Expand description
The markdown module contains the core processing pipeline.
Core Markdown processing functionality.
This module handles the conversion of Markdown content into HTML, with support for custom blocks, enhanced tables, and syntax highlighting.
§Processing Pipeline
- Parse — Markdown source → comrak AST (arena-allocated).
- Transform — Walk the AST to rewrite custom-block
HtmlBlocknodes in-place. - Render — Convert the (possibly modified) AST to HTML, using comrak’s plugin system for syntax highlighting.
- Enhance — Post-process table HTML for responsive wrappers and alignment classes.
- Sanitize — When
allow_unsafe_htmlisfalse, run ammonia to strip dangerous tags while preserving safe structural markup.
Structs§
- Markdown
Options - Options for configuring Markdown processing behavior.
- Sanitizer
Config - User-supplied extensions to the default HTML sanitizer allow-list.
Constants§
- DEFAULT_
MAX_ INPUT_ SIZE - Default maximum input size: 1 MiB.
Functions§
- default_
markdown_ options - Creates a convenience set of options with all features enabled.
- process_
markdown - Processes the input Markdown content and converts it into HTML.
- process_
markdown_ to_ plain_ text - Extracts plain-text content from Markdown, stripping all formatting and markup.
- process_
markdown_ to_ writer - Streams processed HTML directly to a
Writesink. - process_
markdown_ with_ toc - Processes Markdown and returns both the rendered HTML and a document-order table of contents.
- process_
markdown_ with_ toc_ to_ writer - Streams processed HTML to
writerand returns the table of contents collected during the AST walk.