Wenmode#
Build a Markdown dialect with explicit rules, AST output, safe defaults, and pluggable renderers.
Wenmode is for Python applications where Markdown is part of the product model: documentation systems, user-generated content, static-site pipelines, AI/AST workflows, custom dialects, and format converters.
Quick start#
Install Wenmode from PyPI:
pip install wenmode
Render Markdown with the default CommonMark-style rules and safer HTML defaults:
from wenmode import Wenmode
html = Wenmode().render('# Hello\n')
assert html == '<h1>Hello</h1>\n'
Why Wenmode?#
Wenmode comes from the same author as Mistune, redesigned for applications that need to own the full Markdown pipeline.
Choose CommonMark-style Markdown, GitHub-flavored Markdown, streaming output, or the exact rule list your product needs.
Parse to mdast-compatible nodes before indexing, transforming, storing, validating, or rendering content.
Escape raw HTML and sanitize unsafe URLs by default, then opt into trusted passthrough only when your application has a separate sanitization layer.
Parsing, rule selection, transforms, directive handling, and rendering are separate pieces. Start with the default renderer, then opt into presets, plugins, or AST workflows only when your application needs them.
Markdown pipeline#
Wenmode keeps the Markdown pipeline explicit:
Markdown source
-> Parser + explicit rules
-> mdast-compatible nodes
-> transforms, validation, storage, or indexing
-> HTML, Markdown, reStructuredText, AsciiDoc, or custom output
That split lets one application parse once, generate heading IDs, collect a table of contents, store AST JSON for search, and render HTML from the same tree.
Project status#
Wenmode runs CommonMark and GitHub-flavored Markdown fixture suites in its test suite, with documented compatibility boundaries.
The package supports Python 3.10 and newer, including current CPython releases and PyPy versions covered by the project metadata.
Start here#
Goal |
Start here |
|---|---|
Decide whether Wenmode fits your application |
|
Parse Markdown and render HTML |
|
Choose CommonMark, GFM, streaming, or custom rules |
|
Add directives or non-standard syntax |
Directives and Plugins |
Render user-authored Markdown safely |
|
Parse and filter AI-generated Markdown |
|
Build AST transforms, TOCs, or custom renderers |
|
Integrate Wenmode into an application pipeline |
|
Compare Python Markdown parsers |
|
Migrate from another Markdown parser |
|
Check compatibility and project status |