Registry / serialization / mistune

mistune

JSON →
library3.2.0pypypi✓ verified 44d ago

Mistune is a sane and fast Markdown parser for Python, offering various useful plugins and renderers. It is actively maintained, with the current version being 3.2.0, and receives regular updates to support newer Python versions and fix bugs.

serialization
pip install mistune
Install & Compatibility
Where this runs
tested against v3.2.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.085s · 18.5MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.6s · import 0.081s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Markdown
from mistune import Markdown
import mistune

This quickstart demonstrates the simplest way to convert Markdown text to HTML using the `mistune.html()` function, which provides a default setup with many common features enabled.

import mistune markdown_text = """ # Hello, Mistune! This is **bold** text and `code`. - Item 1 - Item 2 """ html_output = mistune.html(markdown_text) print(html_output)
Debug
Known issues
breakingMistune v3 introduced significant breaking changes compared to v2, particularly in custom renderer methods' parameters and the redesign of directives. Migrating existing code, especially custom plugins or renderers, will require updates.
fix
Refer to the official 'Upgrade Guide' for detailed changes. Parameter signatures for custom renderer methods and directive handling have been altered. For instance, `RstDirective` was renamed to `RSTDirective`.
affects: >=3.0.0
gotchaThe default behavior for HTML escaping differs between `mistune.html()` and `mistune.create_markdown()`. `mistune.html()` does not escape raw HTML tags by default, while `mistune.create_markdown()` (without `escape=False`) *does* escape HTML.
fix
If using `create_markdown()`, explicitly set `escape=False` in its parameters if you want raw HTML to be rendered directly: `mistune.create_markdown(escape=False)`. Always be mindful of potential XSS vulnerabilities when disabling HTML escaping for untrusted input.
affects: >=3.0.0
gotchaWhile a global `mistune.markdown()` function exists, for performance-critical applications or when using custom configurations and plugins, it is recommended to create and reuse a `Markdown` instance (e.g., via `mistune.create_markdown()`) rather than calling the global function repeatedly.
fix
Initialize a Markdown instance once using `markdown = mistune.create_markdown(...)` and then call `markdown(text)` for subsequent conversions.
affects: All v3 versions
gotchaVersions of Mistune v3 prior to 3.0.2 experienced a `RecursionError` when parsing complex lists.
fix
Upgrade to `mistune>=3.0.2` to resolve potential `RecursionError` issues with list parsing.
affects: <3.0.2
Upgrade
Version history
3.2.1latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
seranking-bot
4
ahrefsbot
3
bytedance
3
node
2
googlebot
1
Resources