| 1 |
Metadata-Version: 2.4 |
| 2 |
Name: commonmark |
| 3 |
Version: 0.9.2 |
| 4 |
Summary: Python parser for the CommonMark Markdown spec |
| 5 |
Home-page: https://github.com/rtfd/commonmark.py |
| 6 |
Author: Bibek Kafle <[email protected]>, Roland Shoemaker <[email protected]> |
| 7 |
Author-email: [email protected] |
| 8 |
License: BSD-3-Clause |
| 9 |
Keywords: markup,markdown,commonmark |
| 10 |
Classifier: Programming Language :: Python |
| 11 |
Classifier: Programming Language :: Python :: 2 |
| 12 |
Classifier: Programming Language :: Python :: 3 |
| 13 |
Classifier: Development Status :: 5 - Production/Stable |
| 14 |
Classifier: Environment :: Other Environment |
| 15 |
Classifier: Environment :: Console |
| 16 |
Classifier: Intended Audience :: Developers |
| 17 |
Classifier: License :: OSI Approved :: BSD License |
| 18 |
Classifier: Operating System :: OS Independent |
| 19 |
Classifier: Topic :: Documentation |
| 20 |
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content |
| 21 |
Classifier: Topic :: Software Development :: Documentation |
| 22 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 23 |
Classifier: Topic :: Text Processing :: Markup |
| 24 |
Classifier: Topic :: Utilities |
| 25 |
Description-Content-Type: text/x-rst |
| 26 |
License-File: LICENSE |
| 27 |
Requires-Dist: future>=0.14.0; python_version < "3" |
| 28 |
Provides-Extra: test |
| 29 |
Requires-Dist: flake8==3.9.2; extra == "test" |
| 30 |
Requires-Dist: hypothesis==4.24.4; extra == "test" |
| 31 |
Dynamic: author |
| 32 |
Dynamic: author-email |
| 33 |
Dynamic: classifier |
| 34 |
Dynamic: description |
| 35 |
Dynamic: description-content-type |
| 36 |
Dynamic: home-page |
| 37 |
Dynamic: keywords |
| 38 |
Dynamic: license |
| 39 |
Dynamic: license-file |
| 40 |
Dynamic: provides-extra |
| 41 |
Dynamic: requires-dist |
| 42 |
Dynamic: summary |
| 43 |
|
| 44 |
commonmark.py |
| 45 |
============= |
| 46 |
|
| 47 |
|No Maintenance Intended| |
| 48 |
|
| 49 |
**Warning:** commonmark.py is now deprecated. We recommend using `markdown-it-py`_ |
| 50 |
for a commonmark parser going forward. See `this issue`_ for background |
| 51 |
and discussion. |
| 52 |
|
| 53 |
-- |
| 54 |
|
| 55 |
.. _markdown-it-py: https://github.com/executablebooks/markdown-it-py |
| 56 |
.. _this issue: https://github.com/readthedocs/commonmark.py/issues/308 |
| 57 |
|
| 58 |
.. |No Maintenance Intended| image:: http://unmaintained.tech/badge.svg |
| 59 |
:target: http://unmaintained.tech/ |
| 60 |
|
| 61 |
commonmark.py is a pure Python port of `jgm <https://github.com/jgm>`__'s |
| 62 |
`commonmark.js <https://github.com/jgm/commonmark.js>`__, a |
| 63 |
Markdown parser and renderer for the |
| 64 |
`CommonMark <http://commonmark.org>`__ specification, using only native |
| 65 |
modules. Once both this project and the CommonMark specification are |
| 66 |
stable we will release the first ``1.0`` version and attempt to keep up |
| 67 |
to date with changes in ``commonmark.js``. |
| 68 |
|
| 69 |
commonmark.py is tested against the CommonMark spec with Python versions |
| 70 |
2.7, 3.5, 3.6, 3.7, and 3.8. |
| 71 |
|
| 72 |
**Current version:** 0.9.2 |
| 73 |
|
| 74 |
|Pypi Link| |Build Status| |Doc Link| |
| 75 |
|
| 76 |
Installation |
| 77 |
------------ |
| 78 |
|
| 79 |
:: |
| 80 |
|
| 81 |
$ pip install commonmark |
| 82 |
|
| 83 |
Usage |
| 84 |
----- |
| 85 |
|
| 86 |
:: |
| 87 |
|
| 88 |
>>> import commonmark |
| 89 |
>>> commonmark.commonmark('*hello!*') |
| 90 |
'<p><em>hello!</em></p>\n' |
| 91 |
|
| 92 |
Or, without the syntactic sugar: |
| 93 |
|
| 94 |
.. code:: python |
| 95 |
|
| 96 |
import commonmark |
| 97 |
parser = commonmark.Parser() |
| 98 |
ast = parser.parse("Hello *World*") |
| 99 |
|
| 100 |
renderer = commonmark.HtmlRenderer() |
| 101 |
html = renderer.render(ast) |
| 102 |
print(html) # <p>Hello <em>World</em><p/> |
| 103 |
|
| 104 |
# inspecting the abstract syntax tree |
| 105 |
json = commonmark.dumpJSON(ast) |
| 106 |
commonmark.dumpAST(ast) # pretty print generated AST structure |
| 107 |
|
| 108 |
There is also a CLI: |
| 109 |
|
| 110 |
:: |
| 111 |
|
| 112 |
$ cmark README.md -o README.html |
| 113 |
$ cmark README.md -o README.json -aj # output AST as JSON |
| 114 |
$ cmark README.md -a # pretty print generated AST structure |
| 115 |
$ cmark -h |
| 116 |
usage: cmark [-h] [-o [O]] [-a] [-aj] [infile] |
| 117 |
|
| 118 |
Process Markdown according to the CommonMark specification. |
| 119 |
|
| 120 |
positional arguments: |
| 121 |
infile Input Markdown file to parse, defaults to stdin |
| 122 |
|
| 123 |
optional arguments: |
| 124 |
-h, --help show this help message and exit |
| 125 |
-o [O] Output HTML/JSON file, defaults to stdout |
| 126 |
-a Print formatted AST |
| 127 |
-aj Output JSON AST |
| 128 |
|
| 129 |
|
| 130 |
Contributing |
| 131 |
------------ |
| 132 |
|
| 133 |
If you would like to offer suggestions/optimizations/bugfixes through |
| 134 |
pull requests please do! Also if you find an error in the |
| 135 |
parser/renderer that isn't caught by the current test suite please open |
| 136 |
a new issue and I would also suggest you send the |
| 137 |
`commonmark.js <https://github.com/jgm/commonmark.js>`__ project |
| 138 |
a pull request adding your test to the existing test suite. |
| 139 |
|
| 140 |
Tests |
| 141 |
----- |
| 142 |
|
| 143 |
To work on commonmark.py, you will need to be able to run the test suite to |
| 144 |
make sure your changes don't break anything. To run the tests, you can do |
| 145 |
something like this: |
| 146 |
|
| 147 |
:: |
| 148 |
|
| 149 |
$ pyvenv venv |
| 150 |
$ ./venv/bin/python setup.py develop test |
| 151 |
|
| 152 |
The tests script, ``commonmark/tests/run_spec_tests.py``, is pretty much a devtool. As |
| 153 |
well as running all the tests embedded in ``spec.txt`` it also allows you |
| 154 |
to run specific tests using the ``-t`` argument, provide information |
| 155 |
about passed tests with ``-p``, percentage passed by category of test |
| 156 |
with ``-s``, and enter markdown interactively with ``-i`` (In |
| 157 |
interactive mode end a block by inputting a line with just ``end``, to |
| 158 |
quit do the same but with ``quit``). ``-d`` can be used to print call |
| 159 |
tracing. |
| 160 |
|
| 161 |
:: |
| 162 |
|
| 163 |
$ ./venv/bin/python commonmark/tests/run_spec_tests.py -h |
| 164 |
usage: run_spec_tests.py [-h] [-t T] [-p] [-f] [-i] [-d] [-np] [-s] |
| 165 |
|
| 166 |
script to run the CommonMark specification tests against the commonmark.py |
| 167 |
parser. |
| 168 |
|
| 169 |
optional arguments: |
| 170 |
-h, --help show this help message and exit |
| 171 |
-t T Single test to run or comma separated list of tests (-t 10 or -t 10,11,12,13) |
| 172 |
-p Print passed test information |
| 173 |
-f Print failed tests (during -np...) |
| 174 |
-i Interactive Markdown input mode |
| 175 |
-d Debug, trace calls |
| 176 |
-np Only print section header, tick, or cross |
| 177 |
-s Print percent of tests passed by category |
| 178 |
|
| 179 |
Authors |
| 180 |
------- |
| 181 |
|
| 182 |
- `Bibek Kafle <https://github.com/kafle>`__ |
| 183 |
- `Roland Shoemaker <https://github.com/rolandshoemaker>`__ |
| 184 |
|
| 185 |
.. |Pypi Link| image:: https://img.shields.io/pypi/v/commonmark.svg |
| 186 |
:target: https://pypi.org/project/commonmark/ |
| 187 |
|
| 188 |
.. |Build Status| image:: https://travis-ci.org/rtfd/commonmark.py.svg?branch=master |
| 189 |
:target: https://travis-ci.org/rtfd/commonmark.py |
| 190 |
|
| 191 |
.. |Doc Link| image:: https://readthedocs.org/projects/commonmarkpy/badge/?version=latest |
| 192 |
:target: https://commonmarkpy.readthedocs.io/en/latest/?badge=latest |
| 193 |
:alt: Documentation Status |