| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: markdown-it-py |
| 3 |
Version: 3.0.0 |
| 4 |
Summary: Python port of markdown-it. Markdown parsing, done right! |
| 5 |
Keywords: markdown,lexer,parser,commonmark,markdown-it |
| 6 |
Author-email: Chris Sewell <[email protected]> |
| 7 |
Requires-Python: >=3.8 |
| 8 |
Description-Content-Type: text/markdown |
| 9 |
Classifier: Development Status :: 5 - Production/Stable |
| 10 |
Classifier: Intended Audience :: Developers |
| 11 |
Classifier: License :: OSI Approved :: MIT License |
| 12 |
Classifier: Programming Language :: Python :: 3 |
| 13 |
Classifier: Programming Language :: Python :: 3.8 |
| 14 |
Classifier: Programming Language :: Python :: 3.9 |
| 15 |
Classifier: Programming Language :: Python :: 3.10 |
| 16 |
Classifier: Programming Language :: Python :: 3.11 |
| 17 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 18 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 19 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 20 |
Classifier: Topic :: Text Processing :: Markup |
| 21 |
Requires-Dist: mdurl~=0.1 |
| 22 |
Requires-Dist: psutil ; extra == "benchmarking" |
| 23 |
Requires-Dist: pytest ; extra == "benchmarking" |
| 24 |
Requires-Dist: pytest-benchmark ; extra == "benchmarking" |
| 25 |
Requires-Dist: pre-commit~=3.0 ; extra == "code_style" |
| 26 |
Requires-Dist: commonmark~=0.9 ; extra == "compare" |
| 27 |
Requires-Dist: markdown~=3.4 ; extra == "compare" |
| 28 |
Requires-Dist: mistletoe~=1.0 ; extra == "compare" |
| 29 |
Requires-Dist: mistune~=2.0 ; extra == "compare" |
| 30 |
Requires-Dist: panflute~=2.3 ; extra == "compare" |
| 31 |
Requires-Dist: linkify-it-py>=1,<3 ; extra == "linkify" |
| 32 |
Requires-Dist: mdit-py-plugins ; extra == "plugins" |
| 33 |
Requires-Dist: gprof2dot ; extra == "profiling" |
| 34 |
Requires-Dist: mdit-py-plugins ; extra == "rtd" |
| 35 |
Requires-Dist: myst-parser ; extra == "rtd" |
| 36 |
Requires-Dist: pyyaml ; extra == "rtd" |
| 37 |
Requires-Dist: sphinx ; extra == "rtd" |
| 38 |
Requires-Dist: sphinx-copybutton ; extra == "rtd" |
| 39 |
Requires-Dist: sphinx-design ; extra == "rtd" |
| 40 |
Requires-Dist: sphinx_book_theme ; extra == "rtd" |
| 41 |
Requires-Dist: jupyter_sphinx ; extra == "rtd" |
| 42 |
Requires-Dist: coverage ; extra == "testing" |
| 43 |
Requires-Dist: pytest ; extra == "testing" |
| 44 |
Requires-Dist: pytest-cov ; extra == "testing" |
| 45 |
Requires-Dist: pytest-regressions ; extra == "testing" |
| 46 |
Project-URL: Documentation, https://markdown-it-py.readthedocs.io |
| 47 |
Project-URL: Homepage, https://github.com/executablebooks/markdown-it-py |
| 48 |
Provides-Extra: benchmarking |
| 49 |
Provides-Extra: code_style |
| 50 |
Provides-Extra: compare |
| 51 |
Provides-Extra: linkify |
| 52 |
Provides-Extra: plugins |
| 53 |
Provides-Extra: profiling |
| 54 |
Provides-Extra: rtd |
| 55 |
Provides-Extra: testing |
| 56 |
|
| 57 |
# markdown-it-py |
| 58 |
|
| 59 |
[![Github-CI][github-ci]][github-link] |
| 60 |
[![Coverage Status][codecov-badge]][codecov-link] |
| 61 |
[![PyPI][pypi-badge]][pypi-link] |
| 62 |
[![Conda][conda-badge]][conda-link] |
| 63 |
[![Code style: black][black-badge]][black-link] |
| 64 |
[![PyPI - Downloads][install-badge]][install-link] |
| 65 |
|
| 66 |
> Markdown parser done right. |
| 67 |
|
| 68 |
- Follows the __[CommonMark spec](http://spec.commonmark.org/)__ for baseline parsing |
| 69 |
- Configurable syntax: you can add new rules and even replace existing ones. |
| 70 |
- Pluggable: Adds syntax extensions to extend the parser (see the [plugin list][md-plugins]). |
| 71 |
- High speed (see our [benchmarking tests][md-performance]) |
| 72 |
- [Safe by default][md-security] |
| 73 |
- Member of [Google's Assured Open Source Software](https://cloud.google.com/assured-open-source-software/docs/supported-packages) |
| 74 |
|
| 75 |
This is a Python port of [markdown-it], and some of its associated plugins. |
| 76 |
For more details see: <https://markdown-it-py.readthedocs.io>. |
| 77 |
|
| 78 |
For details on [markdown-it] itself, see: |
| 79 |
|
| 80 |
- The __[Live demo](https://markdown-it.github.io)__ |
| 81 |
- [The markdown-it README][markdown-it-readme] |
| 82 |
|
| 83 |
## Installation |
| 84 |
|
| 85 |
```bash |
| 86 |
conda install -c conda-forge markdown-it-py |
| 87 |
``` |
| 88 |
|
| 89 |
or |
| 90 |
|
| 91 |
```bash |
| 92 |
pip install markdown-it-py[plugins] |
| 93 |
``` |
| 94 |
|
| 95 |
or with extras |
| 96 |
|
| 97 |
```bash |
| 98 |
conda install -c conda-forge markdown-it-py linkify-it-py mdit-py-plugins |
| 99 |
pip install markdown-it-py[linkify,plugins] |
| 100 |
``` |
| 101 |
|
| 102 |
## Usage |
| 103 |
|
| 104 |
### Python API Usage |
| 105 |
|
| 106 |
Render markdown to HTML with markdown-it-py and a custom configuration |
| 107 |
with and without plugins and features: |
| 108 |
|
| 109 |
```python |
| 110 |
from markdown_it import MarkdownIt |
| 111 |
from mdit_py_plugins.front_matter import front_matter_plugin |
| 112 |
from mdit_py_plugins.footnote import footnote_plugin |
| 113 |
|
| 114 |
md = ( |
| 115 |
MarkdownIt('commonmark' ,{'breaks':True,'html':True}) |
| 116 |
.use(front_matter_plugin) |
| 117 |
.use(footnote_plugin) |
| 118 |
.enable('table') |
| 119 |
) |
| 120 |
text = (""" |
| 121 |
--- |
| 122 |
a: 1 |
| 123 |
--- |
| 124 |
|
| 125 |
a | b |
| 126 |
- | - |
| 127 |
1 | 2 |
| 128 |
|
| 129 |
A footnote [^1] |
| 130 |
|
| 131 |
[^1]: some details |
| 132 |
""") |
| 133 |
tokens = md.parse(text) |
| 134 |
html_text = md.render(text) |
| 135 |
|
| 136 |
## To export the html to a file, uncomment the lines below: |
| 137 |
# from pathlib import Path |
| 138 |
# Path("output.html").write_text(html_text) |
| 139 |
``` |
| 140 |
|
| 141 |
### Command-line Usage |
| 142 |
|
| 143 |
Render markdown to HTML with markdown-it-py from the |
| 144 |
command-line: |
| 145 |
|
| 146 |
```console |
| 147 |
usage: markdown-it [-h] [-v] [filenames [filenames ...]] |
| 148 |
|
| 149 |
Parse one or more markdown files, convert each to HTML, and print to stdout |
| 150 |
|
| 151 |
positional arguments: |
| 152 |
filenames specify an optional list of files to convert |
| 153 |
|
| 154 |
optional arguments: |
| 155 |
-h, --help show this help message and exit |
| 156 |
-v, --version show program's version number and exit |
| 157 |
|
| 158 |
Interactive: |
| 159 |
|
| 160 |
$ markdown-it |
| 161 |
markdown-it-py [version 0.0.0] (interactive) |
| 162 |
Type Ctrl-D to complete input, or Ctrl-C to exit. |
| 163 |
>>> # Example |
| 164 |
... > markdown *input* |
| 165 |
... |
| 166 |
<h1>Example</h1> |
| 167 |
<blockquote> |
| 168 |
<p>markdown <em>input</em></p> |
| 169 |
</blockquote> |
| 170 |
|
| 171 |
Batch: |
| 172 |
|
| 173 |
$ markdown-it README.md README.footer.md > index.html |
| 174 |
|
| 175 |
``` |
| 176 |
|
| 177 |
## References / Thanks |
| 178 |
|
| 179 |
Big thanks to the authors of [markdown-it]: |
| 180 |
|
| 181 |
- Alex Kocharin [github/rlidwka](https://github.com/rlidwka) |
| 182 |
- Vitaly Puzrin [github/puzrin](https://github.com/puzrin) |
| 183 |
|
| 184 |
Also [John MacFarlane](https://github.com/jgm) for his work on the CommonMark spec and reference implementations. |
| 185 |
|
| 186 |
[github-ci]: https://github.com/executablebooks/markdown-it-py/workflows/Python%20package/badge.svg?branch=master |
| 187 |
[github-link]: https://github.com/executablebooks/markdown-it-py |
| 188 |
[pypi-badge]: https://img.shields.io/pypi/v/markdown-it-py.svg |
| 189 |
[pypi-link]: https://pypi.org/project/markdown-it-py |
| 190 |
[conda-badge]: https://anaconda.org/conda-forge/markdown-it-py/badges/version.svg |
| 191 |
[conda-link]: https://anaconda.org/conda-forge/markdown-it-py |
| 192 |
[codecov-badge]: https://codecov.io/gh/executablebooks/markdown-it-py/branch/master/graph/badge.svg |
| 193 |
[codecov-link]: https://codecov.io/gh/executablebooks/markdown-it-py |
| 194 |
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg |
| 195 |
[black-link]: https://github.com/ambv/black |
| 196 |
[install-badge]: https://img.shields.io/pypi/dw/markdown-it-py?label=pypi%20installs |
| 197 |
[install-link]: https://pypistats.org/packages/markdown-it-py |
| 198 |
|
| 199 |
[CommonMark spec]: http://spec.commonmark.org/ |
| 200 |
[markdown-it]: https://github.com/markdown-it/markdown-it |
| 201 |
[markdown-it-readme]: https://github.com/markdown-it/markdown-it/blob/master/README.md |
| 202 |
[md-security]: https://markdown-it-py.readthedocs.io/en/latest/other.html |
| 203 |
[md-performance]: https://markdown-it-py.readthedocs.io/en/latest/other.html |
| 204 |
[md-plugins]: https://markdown-it-py.readthedocs.io/en/latest/plugins.html |
| 205 |
|