mkconvert
One API for many Markdown parsers. mkconvert wraps Python and Rust Markdown → HTML
libraries behind a common BaseParser interface, adds an optional processing pipeline
(pre-processors, HTML tree processors, post-processors such as sanitizing), and offers
HTML → Markdown conversion. Every backend is an optional extra, so you only install what you use.
Installation
pip install "mkconvert[comrak]" # Rust-based Comrak parser
pip install "mkconvert[markdown]" # Python-Markdown + pymdown-extensions
pip install "mkconvert[comrak,lxml,nh3]" # pipeline with lxml tree processing and sanitizing
Parser extras: comrak, pyromark, markdown_it_pyrs, markdown, markdown2, mistune,
marko, cmarkgfm, httpx2 (GitHub API parser; httpx is an alias).
Other extras: lxml, nh3, bleach, beautifulsoup4, htmd-py, markdownify.
comrak, pyromark and lxml are currently only installed on Python < 3.14.
Quickstart
Use a backend directly:
from mkconvert import ComrakParser
parser = ComrakParser(header_ids=True)
html = parser.convert("# Hello\n\n~~old~~ **new**")
print(parser.name, sorted(parser.features))
All parsers share the same interface (convert(), name, features):
ComrakParser, PyroMarkParser, MarkdownItPyRSParser, PythonMarkdownParser,
Markdown2Parser, MistuneParser, MarkoParser, GithubApiParser
and mkconvert.parsers.cmarkgfm_parser.CMarkGfmParser.
Build a pipeline with processors:
from mkconvert import ExtractTitleETProcessor, MarkdownParser, MkDocsToGFMAdmonitionProcessor
pipeline = MarkdownParser(rust_parser="comrak") # or "pyromark", "markdown-it-pyrs"
pipeline.pre_processors.register_processor(MkDocsToGFMAdmonitionProcessor())
title = ExtractTitleETProcessor()
pipeline.tree_processors.register_et_processor(title)
html = pipeline.convert('# Guide\n\n!!! note "Heads up"\n Read this first.\n')
print(title.title) # "Guide"
Convert HTML back to Markdown, or sanitize HTML:
from mkconvert.html_to_md.factory import create_html_to_markdown
from mkconvert.sanitizers.factory import create_sanitizer
markdown = create_html_to_markdown().convert("<h1>Title</h1><p><b>bold</b></p>")
safe_html = create_sanitizer().sanitize("<p>hi<script>bad()</script></p>")
Features
- Uniform
BaseParserAPI over nine Markdown backends, with per-backend feature sets. MarkdownParserpipeline: pre-processors (e.g. MkDocs admonitions → GitHub alerts), ElementTree or lxml tree processors (e.g. title extraction), post-processors (SanitizeHTMLProcessor,Prettify).- HTML → Markdown via htmd (Rust) or markdownify, with shared style options.
- HTML sanitizing via nh3 (Rust) or bleach.
Backend feature comparison
| Feature | Python-Markdown | Markdown2 | Mistune | Comrak (Rust) | PyroMark (Rust) | Markdown-It-PyRS (Rust) |
|---|---|---|---|---|---|---|
| Core CommonMark | ✅ | ✅ | ✅ | ✅ (100% compliant) | ✅ | ✅ (100% compliant) |
| Fenced code blocks | ✅ | ✅ (with ext) | ✅ | ✅ | ✅ | ✅ |
| GitHub Flavored Markdown | ||||||
| Tables | ✅ (with ext) | ✅ (with ext) | ✅ (with plugin) | ✅ (with .table) |
✅ (optional) | ✅ (with GFM or .table) |
| Task lists | ✅ (with pymdownx.tasklist) | ✅ (with ext) | ✅ (with plugin) | ✅ (with .tasklist) |
✅ (optional) | ✅ (with .tasklist) |
| Strikethrough | ✅ (with pymdownx.tilde) | ✅ (with ext) | ✅ (with plugin) | ✅ (with .strikethrough) |
✅ (optional) | ✅ (with GFM or .strikethrough) |
| Autolinks | ✅ (with pymdownx.magiclink) | ❌ | ✅ (with plugin) | ✅ (with .autolink) |
✅ (with GFM) | ✅ (with .autolink_ext) |
| GFM Alerts | ❌ | ❌ | ❌ | ✅ (with .alerts) |
✅ (with GFM) | ❌ |
| Extended Features | ||||||
| Footnotes | ✅ (with ext) | ✅ (with ext) | ✅ (with plugin) | ✅ (with .footnotes) |
✅ (optional) | ✅ (with .footnote) |
| Definition lists | ✅ (with ext) | ✅ (with ext) | ❌ | ✅ (with .description_lists) |
✅ (optional) | ✅ (with .deflist) |
| Admonitions | ✅ (with ext) | ❌ | ❌ | ❌ | ❌ | ❌ |
| Math notation | ✅ (with pymdownx.arithmatex) | ❌ | ✅ (with plugin) | ✅ (with .math_dollars/.math_code) |
✅ (optional) | ❌ |
| Superscript | ✅ (with ext) | ❌ | ❌ | ✅ (with .superscript) |
✅ (optional) | ❌ |
| Subscript | ✅ (with ext) | ❌ | ❌ | ✅ (with .subscript) |
✅ (optional) | ❌ |
| Table of Contents | ✅ (with ext) | ✅ (with ext) | ❌ | ❌ | ❌ | ❌ |
| Front matter | ✅ (with ext) | ✅ (with ext) | ❌ | ✅ (with .front_matter_delimiter) |
✅ (optional) | ✅ (with .front_matter) |
| Wikilinks | ✅ (with ext) | ❌ | ❌ | ✅ (with .wikilinks_*) |
✅ (optional) | ❌ |
| Header IDs | ✅ (with ext) | ✅ (with ext) | ❌ | ✅ (with .header_ids) |
✅ (optional) | ✅ (with .heading_anchors) |
| Multiline blockquotes | ❌ | ❌ | ❌ | ✅ (with .multiline_block_quotes) |
❌ | ❌ |
| Syntax highlighting | ✅ (with ext) | ✅ (with ext) | ✅ (with plugin) | ✅ (with plugins) | ❌ | ❌ |
| Special features | Admonitions | Smart quotes | Custom renderers | Spoiler, Greentext | Definition lists | Tree structure, very fast (20x faster than Python-Markdown) |
Metadata
Release files for mkconvert 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkconvert-1.2.0.tar.gz | 33.7 kB | With provenance | Details for mkconvert-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkconvert-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for mkconvert-1.2.0-py3-none-any.whl |
Total release size: 84.2 kB
Release files / mkconvert-1.2.0.tar.gz
| Download URL | mkconvert-1.2.0.tar.gz |
|---|---|
| Size | 33.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00a536073bf5c0c12bf0d592273b16c01abeaffcc675619d17d2041eb588c8ee
|
|
BLAKE2b-256 checksum How to use checksums |
6a2ebdb290fc2c6a45448b41c2725368e25889af395a2d93904640adba7e443b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / mkconvert-1.2.0-py3-none-any.whl
| Download URL | mkconvert-1.2.0-py3-none-any.whl |
|---|---|
| Size | 50.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a654558a326e136f8a9db438ee9605cf9008be64e293a4310455cd99f07aed8a
|
|
BLAKE2b-256 checksum How to use checksums |
a94255ce7c049d4e74ed8071b8a9058be559ec7295b0afdcc5f25142d46ed742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for mkconvert 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mkconvert-1.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.