mdit-plain is a Python renderer for the markdown-it-py library, designed to convert Markdown documents into clean plain text by effectively stripping out all markup. Its primary purpose is to facilitate Natural Language Processing (NLP) and other text-based analyses where unformatted content is required. The current version is 1.0.1, released in January 2023, indicating a slow release cadence since then.
pip install mdit-plainVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize markdown-it-py with the mdit-plain renderer to convert a Markdown string into plain text, effectively removing all formatting.
Check for official mdit-plain updates or compatibility notes for newer markdown-it-py versions. If no update is available, consider pinning markdown-it-py to a compatible older version (e.g., `<4.0.0`) or implementing a custom plain text renderer.
For highly normalized plain text output, additional post-processing steps (e.g., using regular expressions for whitespace, or a library like BeautifulSoup if an intermediate HTML conversion is acceptable) may be necessary after mdit-plain has processed the text.
Be aware that new Markdown syntax or complex parsing requirements might not be supported. Consider contributing to the project, forking it, or exploring alternative solutions if active development and immediate support are critical.
Install the required dependency: `pip install markdown-it-py`
Ensure mdit-plain is installed (`pip install mdit-plain`) and the import statement is `from mdit_plain.renderer import RendererPlain`.
When initializing `MarkdownIt`, ensure you pass `renderer_cls=RendererPlain`: `parser = MarkdownIt(renderer_cls=RendererPlain)`.