Skip to content

Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed. Now in Python!

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.markdown-it
Notifications You must be signed in to change notification settings

westurner/markdown-it-py

 
 

Repository files navigation

markdown-it-py

Github-CI Coverage Status PyPI Conda Code style: black PyPI - Downloads

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:

Installation

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

or

pip install markdown-it-py

Basic usage

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

md = (
    MarkdownIt()
    .use(front_matter_plugin)
    .use(footnote_plugin)
    .disable('image')
    .enable('table')
)
text = ("""
---
a: 1
---

a | b
- | -
1 | 2

A footnote [^1]

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

Also you can use it from the command-line:

$ markdown-it
markdown-it-py [version 0.1.0] (interactive)
Type Ctrl-D to complete input, or Ctrl-C to exit.
>>> > **hallo** there!
...
<blockquote>
<p><strong>hallo</strong> there!</p>
</blockquote>

References / Thanks

Big thanks to the authors of markdown-it:

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

About

Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed. Now in Python!

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.markdown-it

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 58.1%
  • HTML 39.6%
  • JavaScript 2.2%
  • Shell 0.1%