markdown-it-pyrs
raw JSON → 0.4.0 verified Fri May 01 auth: no python
A Python interface for markdown-it.rs, using Rust for blazingly fast Markdown parsing. Current version 0.4.0, requires Python >=3.9. Release cadence is irregular.
pip install markdown-it-pyrs Common errors
error ModuleNotFoundError: No module named 'markdown_it' ↓
cause Installed markdown-it-pyrs but tried importing 'markdown_it' (which is the pure Python package).
fix
Install markdown-it-py or change import to 'from markdown_it_pyrs import MarkdownIt'.
error TypeError: __init__() got an unexpected keyword argument 'xhtml' ↓
cause Passing xhtml as a constructor argument, but starting from v0.2.1 it is only accepted in the render method.
fix
Remove xhtml from MarkdownIt() and pass it to render(): md.render(text, xhtml=True).
Warnings
breaking In v0.2.1, the xhtml option was moved from constructor to the render method. Code that passed xhtml=True to MarkdownIt() will break. ↓
fix Pass xhtml=True to md.render(text, xhtml=True) instead of to the constructor.
deprecated Python 3.8 support was dropped in v0.4.0. Users on Python 3.8 must stay on an older version or upgrade Python. ↓
fix Upgrade to Python 3.9 or later.
gotcha The library name and import path differ: PyPI package name uses hyphens (markdown-it-pyrs), but Python import uses underscores (markdown_it_pyrs). ↓
fix Use 'import markdown_it_pyrs' or 'from markdown_it_pyrs import MarkdownIt'.
Imports
- MarkdownIt wrong
from markdown_it import MarkdownItcorrectfrom markdown_it_pyrs import MarkdownIt
Quickstart
from markdown_it_pyrs import MarkdownIt
md = MarkdownIt()
html = md.render("Hello **world**")
print(html)