MCPcopy Index your code
hub / github.com/executablebooks/markdown-it-py

github.com/executablebooks/markdown-it-py @v4.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.2.0 ↗ · + Follow
407 symbols 1,582 edges 89 files 174 documented · 43% 101 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

markdown-it-py

Github-CI Coverage Status PyPI Conda PyPI - Downloads

markdown-it-py icon

Markdown parser done right.

This is a Python port of markdown-it, and some of its associated plugins. For more details see: https://markdown-it-py.readthedocs.io.

For details on markdown-it itself, see:

See also: markdown-it-pyrs for an experimental Rust binding, for even more speed!

Installation

PIP

pip install markdown-it-py[plugins]

or with extras

pip install markdown-it-py[linkify,plugins]

Conda

conda install -c conda-forge markdown-it-py

or with extras

conda install -c conda-forge markdown-it-py linkify-it-py mdit-py-plugins

Usage

Python API Usage

Render markdown to HTML with markdown-it-py and a custom configuration with and without plugins and features:

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)
    .enable('table')
)
text = ("""
---
a: 1
---

a | b
- | -
1 | 2

A footnote [^1]

[^1]: some details
""")
tokens = md.parse(text)
html_text = md.render(text)

## To export the html to a file, uncomment the lines below:
# from pathlib import Path
# Path("output.html").write_text(html_text)

Command-line Usage

Render markdown to HTML with markdown-it-py from the command-line:

usage: markdown-it [-h] [-v] [--stdin|filenames [filenames ...]]

Parse one or more markdown files, convert each to HTML, and print to stdout

positional arguments:
  --stdin        read source Markdown file from standard input
  filenames      specify an optional list of files to convert

optional arguments:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit

Interactive:

  $ markdown-it
  markdown-it-py [version 0.0.0] (interactive)
  Type Ctrl-D to complete input, or Ctrl-C to exit.
  >>> # Example
  ... > markdown *input*
  ...
  <h1>Example</h1>
  <blockquote>


markdown <em>input</em>


  </blockquote>

Batch:

  $ markdown-it README.md README.footer.md > index.html

References / Thanks

Big thanks to the authors of markdown-it:

Also John MacFarlane for his work on the CommonMark spec and reference implementations.

Core symbols most depended-on inside this repo

parse
called by 58
markdown_it/main.py
push
called by 43
markdown_it/rules_block/state_block.py
render
called by 30
markdown_it/main.py
push
called by 26
markdown_it/rules_inline/state_inline.py
isStrSpace
called by 22
markdown_it/common/utils.py
charCodeAt
called by 19
markdown_it/common/utils.py
is_code_block
called by 16
markdown_it/rules_block/state_block.py
enable
called by 12
markdown_it/ruler.py

Shape

Function 197
Method 164
Class 31
Route 15

Languages

Python100%

Modules by API surface

markdown_it/tree.py31 symbols
tests/test_api/test_make_fence_rule.py28 symbols
tests/test_port/test_fixtures.py26 symbols
markdown_it/utils.py21 symbols
markdown_it/ruler.py20 symbols
markdown_it/main.py20 symbols
markdown_it/renderer.py19 symbols
markdown_it/common/utils.py19 symbols
tests/test_api/test_plugin_creation.py17 symbols
tests/test_api/test_main.py15 symbols
markdown_it/rules_block/state_block.py14 symbols
markdown_it/token.py12 symbols

For agents

$ claude mcp add markdown-it-py \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page