Skip to main content

mkconvert

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this month Package status PyUp

Read the documentation!

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, httpx (GitHub API parser). 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 BaseParser API over nine Markdown backends, with per-backend feature sets.
  • MarkdownParser pipeline: 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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkconvert 1.1.0
File Size Uploaded Provenance Actions
mkconvert-1.1.0.tar.gz 33.6 kB With provenance Details for mkconvert-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mkconvert 1.1.0
File Interpreter ABI Platform Actions
mkconvert-1.1.0-py3-none-any.whl Python 3 none any Details for mkconvert-1.1.0-py3-none-any.whl

Total release size: 84.1 kB

Release files / mkconvert-1.1.0.tar.gz

Download URL mkconvert-1.1.0.tar.gz
Size 33.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a22621e9c84ad5948841adb6d2e2fe3f6d78adeae5cd9e4253681e226e7a42a
BLAKE2b-256 checksum
How to use checksums
4d4d275da312a75323442b098884f9171aefe60bfc62eabe1a53d2c1fc61807f
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 22, 2026.

Transparency log

Release files / mkconvert-1.1.0-py3-none-any.whl

Download URL mkconvert-1.1.0-py3-none-any.whl
Size 50.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a707870bbcf92c783bfc5294a79d266ed3d31292a3002c09fcc6ebef03dd8a8
BLAKE2b-256 checksum
How to use checksums
56c7fe9234c750f1b3eb0b224fe6d28736d0310376deb3c2e73635313edf0193
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 22, 2026.

Transparency log

Security for mkconvert 1.1.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.

Select from 2 files

Attestation for mkconvert-1.1.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 22, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page