Registry / serialization / m2r
library0.3.1pypypi✓ verified 84d ago

m2r is a Python utility for converting Markdown files to reStructuredText, enabling inclusion of Markdown content in Sphinx documentation. Version 0.3.1 is the latest release; the library is no longer actively maintained.

pip install m2r
INSTALL
IMPORT
SIG · M2R
M
m2r
serializationpythonv0.3.1
Install
2.9s avg
Import
176ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.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.95 runs
installs and imports cleanly · install 0.0s · import 0.188s · 23.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.9s · import 0.164s · 24MB
22MB installed
● package 22MB
Code
Verified usage

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

convert
from m2r import convert
import m2r; m2r.convert()
Direct import of convert function is correct; module-level call also works but less explicit.
parse_from_file
from m2r import parse_from_file
Converts a Markdown file to RST string.

Convert a Markdown string to reStructuredText.

from m2r import convert markdown_text = "# Hello\n\nThis is **Markdown**." rst_text = convert(markdown_text) print(rst_text)
m2r --version
Debug
Known issues
deprecatedm2r is no longer actively maintained. Consider using m2r2, recommonmark, or MyST for continued support.
fix
Replace 'm2r' with 'm2r2' or use 'recommonmark' or 'myst-parser' for Sphinx.
affects: all
gotcham2r's conversion is not lossless; some Markdown constructs may not translate correctly to RST.
fix
Review converted output manually and adjust source Markdown or use an alternative converter.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'm2r'
m2r is not installed.
fix
Run: pip install m2r
ImportError: cannot import name 'convert' from 'm2r'
Outdated version (<0.2.0) where convert function existed under different name or not at all.
fix
Upgrade m2r: pip install --upgrade m2r
AttributeError: 'NoneType' object has no attribute 'groups'
Incompatibility with newer versions of mistune (mistune>=2.0.0 changed API).
fix
Pin mistune to version <2.0.0: pip install 'mistune<2.0.0'
Upgrade
Version history
0.3.1latest on PyPI · released Nov 17, 2022
Audit
Dependencies
mistunerequiredMarkdown parsing engine (m2r wraps mistune)
docutilsrequiredreStructuredText processing
Agent activity
2 hits · last 30 days
node
2
Resources
m2r — pip install m2r · libregistry