Markdown-it-py Plugins

0.5.0 · active · verified Sun Mar 29

mdit-py-plugins is a collection of plugins for markdown-it-py, the Python Markdown parser. It provides syntax extensions for footnotes, front matter, definition lists, task lists, heading anchors, math (LaTeX), and more. The current version is 0.5.0, and the library is actively maintained with regular releases.

Warnings

Install

Imports

Quickstart

Initializes MarkdownIt with 'commonmark' preset and enables the front matter and footnote plugins, then renders a sample Markdown string to HTML.

from markdown_it import MarkdownIt
from mdit_py_plugins.front_matter import front_matter_plugin
from mdit_py_plugins.footnote import footnote_plugin

md = (
    MarkdownIt('commonmark', {'breaks': True, 'html': True})
    .use(front_matter_plugin)
    .use(footnote_plugin, always_match_refs=True)
    .enable('table')
)

markdown_input = """
---
title: My Document
---

# Hello World

This is some text with a footnote[^1] and a table.

| Header 1 | Header 2 |
|----------|----------|
| Cell 1   | Cell 2   |

[^1]: This is the footnote content.
"""

html_output = md.render(markdown_input)
print(html_output)

view raw JSON →