This commit is contained in:
Waylon Walker 2022-03-31 20:20:07 -05:00
commit 38355d2442
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
9083 changed files with 1225834 additions and 0 deletions

View file

@ -0,0 +1,32 @@
Copyright (c) 2014, Bibek Kafle and Roland Shoemaker
Based on stmd.js: Copyright (c) 2014, John MacFarlane
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the names of Bibek Kafle, Roland Shoemaker nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,172 @@
Metadata-Version: 2.1
Name: commonmark
Version: 0.9.1
Summary: Python parser for the CommonMark Markdown spec
Home-page: https://github.com/rtfd/commonmark.py
Author: Bibek Kafle <bkafle662@gmail.com>, Roland Shoemaker <rolandshoemaker@gmail.com>
Author-email: rolandshoemaker@gmail.com
Maintainer: Nikolas Nyby
Maintainer-email: nikolas@gnu.org
License: BSD-3-Clause
Keywords: markup,markdown,commonmark
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Other Environment
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Documentation
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Utilities
Description-Content-Type: text/x-rst
Requires-Dist: future (>=0.14.0) ; python_version < "3"
Provides-Extra: test
Requires-Dist: flake8 (==3.7.8) ; extra == 'test'
Requires-Dist: hypothesis (==3.55.3) ; extra == 'test'
commonmark.py
=============
commonmark.py is a pure Python port of `jgm <https://github.com/jgm>`__'s
`commonmark.js <https://github.com/jgm/commonmark.js>`__, a
Markdown parser and renderer for the
`CommonMark <http://commonmark.org>`__ specification, using only native
modules. Once both this project and the CommonMark specification are
stable we will release the first ``1.0`` version and attempt to keep up
to date with changes in ``commonmark.js``.
commonmark.py is tested against the CommonMark spec with Python versions
2.7, 3.4, 3.5, 3.6, and 3.7.
**Current version:** 0.9.1
|Pypi Link| |Build Status| |Doc Link|
Installation
------------
::
$ pip install commonmark
Usage
-----
::
>>> import commonmark
>>> commonmark.commonmark('*hello!*')
'<p><em>hello!</em></p>\n'
Or, without the syntactic sugar:
.. code:: python
import commonmark
parser = commonmark.Parser()
ast = parser.parse("Hello *World*")
renderer = commonmark.HtmlRenderer()
html = renderer.render(ast)
print(html) # <p>Hello <em>World</em><p/>
# inspecting the abstract syntax tree
json = commonmark.dumpJSON(ast)
commonmark.dumpAST(ast) # pretty print generated AST structure
There is also a CLI:
::
$ cmark README.md -o README.html
$ cmark README.md -o README.json -aj # output AST as JSON
$ cmark README.md -a # pretty print generated AST structure
$ cmark -h
usage: cmark [-h] [-o [O]] [-a] [-aj] [infile]
Process Markdown according to the CommonMark specification.
positional arguments:
infile Input Markdown file to parse, defaults to stdin
optional arguments:
-h, --help show this help message and exit
-o [O] Output HTML/JSON file, defaults to stdout
-a Print formatted AST
-aj Output JSON AST
Contributing
------------
If you would like to offer suggestions/optimizations/bugfixes through
pull requests please do! Also if you find an error in the
parser/renderer that isn't caught by the current test suite please open
a new issue and I would also suggest you send the
`commonmark.js <https://github.com/jgm/commonmark.js>`__ project
a pull request adding your test to the existing test suite.
Tests
-----
To work on commonmark.py, you will need to be able to run the test suite to
make sure your changes don't break anything. To run the tests, you can do
something like this:
::
$ pyvenv venv
$ ./venv/bin/python setup.py develop test
The tests script, ``commonmark/tests/run_spec_tests.py``, is pretty much a devtool. As
well as running all the tests embedded in ``spec.txt`` it also allows you
to run specific tests using the ``-t`` argument, provide information
about passed tests with ``-p``, percentage passed by category of test
with ``-s``, and enter markdown interactively with ``-i`` (In
interactive mode end a block by inputting a line with just ``end``, to
quit do the same but with ``quit``). ``-d`` can be used to print call
tracing.
::
$ ./venv/bin/python commonmark/tests/run_spec_tests.py -h
usage: run_spec_tests.py [-h] [-t T] [-p] [-f] [-i] [-d] [-np] [-s]
script to run the CommonMark specification tests against the commonmark.py
parser.
optional arguments:
-h, --help show this help message and exit
-t T Single test to run or comma separated list of tests (-t 10 or -t 10,11,12,13)
-p Print passed test information
-f Print failed tests (during -np...)
-i Interactive Markdown input mode
-d Debug, trace calls
-np Only print section header, tick, or cross
-s Print percent of tests passed by category
Authors
-------
- `Bibek Kafle <https://github.com/kafle>`__
- `Roland Shoemaker <https://github.com/rolandshoemaker>`__
- `Nikolas Nyby <https://github.com/nikolas>`__
.. |Pypi Link| image:: https://img.shields.io/pypi/v/commonmark.svg
:target: https://pypi.org/project/commonmark/
.. |Build Status| image:: https://travis-ci.org/rtfd/commonmark.py.svg?branch=master
:target: https://travis-ci.org/rtfd/commonmark.py
.. |Doc Link| image:: https://readthedocs.org/projects/commonmarkpy/badge/?version=latest
:target: https://commonmarkpy.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

View file

@ -0,0 +1,44 @@
../../../bin/cmark,sha256=k9bQkZEkybM7GZnunEEqO8331IYB-C7Ga-3-nVngP5c,252
commonmark-0.9.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
commonmark-0.9.1.dist-info/LICENSE,sha256=2gzYPRg8HXgZy_BFQcKl0fX2g47YKBCpFDqJ3cvCt94,1645
commonmark-0.9.1.dist-info/METADATA,sha256=Fleg3xhzbgFyI3hktxT4IKS1zEf4H2yuqagr45tWVGg,5710
commonmark-0.9.1.dist-info/RECORD,,
commonmark-0.9.1.dist-info/WHEEL,sha256=8zNYZbwQSXoB9IfXOjPfeNwvAsALAjffgk27FqvCWbo,110
commonmark-0.9.1.dist-info/entry_points.txt,sha256=2BCwg8CgltQzHs9fEBAhyAYiRIj91-3MozIz9Xs-nCQ,49
commonmark-0.9.1.dist-info/top_level.txt,sha256=HeslGuf22YTnjJce2B9Q2yrMRAr_Gia2EDi47Dye_Ig,11
commonmark/__init__.py,sha256=RqqRUq_nHkT5wIsiQEdILfl6hFSiokLSWpfSAvgFEa0,302
commonmark/__pycache__/__init__.cpython-38.pyc,,
commonmark/__pycache__/blocks.cpython-38.pyc,,
commonmark/__pycache__/cmark.cpython-38.pyc,,
commonmark/__pycache__/common.cpython-38.pyc,,
commonmark/__pycache__/dump.cpython-38.pyc,,
commonmark/__pycache__/entitytrans.cpython-38.pyc,,
commonmark/__pycache__/inlines.cpython-38.pyc,,
commonmark/__pycache__/main.cpython-38.pyc,,
commonmark/__pycache__/node.cpython-38.pyc,,
commonmark/__pycache__/normalize_reference.cpython-38.pyc,,
commonmark/blocks.py,sha256=GGPw34diVDEnEeO99OEu2ORmgKC1x8yvYin3uDdYQQg,30411
commonmark/cmark.py,sha256=ssCG5zCsFipenNmwjc8FriRpVjn7UbnDMUc7WGWcGH4,1430
commonmark/common.py,sha256=PE8oRuraJH8IZovPUkywUi_8ix4yNMruEJsQfhZzep0,3309
commonmark/dump.py,sha256=VGsnONW_Gtmwp57qfj4TZw3tyDv3sjEtW3GqboWeZJU,3644
commonmark/entitytrans.py,sha256=6CQTSe7RIOvCFTOAC-V8f9UHWElVo-WobpdVBsQsHS8,61553
commonmark/inlines.py,sha256=myBArP34yOcV3luwTFoET1Wxr6YrZ_2N4yGUY_GKfzA,30985
commonmark/main.py,sha256=WNp0rNa7pFO8aDyG7PxtYuhQMJGPc7teR3nPmJPQkgQ,1268
commonmark/node.py,sha256=eVZuPU1eDN-gyEQkXtECDUAUmgC7iRynnBk3GuoXG04,4614
commonmark/normalize_reference.py,sha256=dec-gL7R-hZywxy4gF0b60P6FksEU7AvXAzYZsP0UFc,6388
commonmark/render/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
commonmark/render/__pycache__/__init__.cpython-38.pyc,,
commonmark/render/__pycache__/html.cpython-38.pyc,,
commonmark/render/__pycache__/renderer.cpython-38.pyc,,
commonmark/render/__pycache__/rst.cpython-38.pyc,,
commonmark/render/html.py,sha256=eLOM4kGWCBS0dOMzp0RluXL2bDTacHB6hI1Iax-PmBY,6585
commonmark/render/renderer.py,sha256=alZSDpipMFnMT69G1XmmapRrdDQU7F4J9e0F_V3aahw,1121
commonmark/render/rst.py,sha256=OTWTYc29QRFdC0p6LNL2wDdw_CNJKjOeMrVMfNQJiLo,3879
commonmark/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
commonmark/tests/__pycache__/__init__.cpython-38.pyc,,
commonmark/tests/__pycache__/rst_tests.cpython-38.pyc,,
commonmark/tests/__pycache__/run_spec_tests.cpython-38.pyc,,
commonmark/tests/__pycache__/unit_tests.cpython-38.pyc,,
commonmark/tests/rst_tests.py,sha256=GtW3aE26zeAbP5QP-PE2sjA_fpVhE2WIuRWs1ndMAq8,3540
commonmark/tests/run_spec_tests.py,sha256=AMc_CzFWFoorSgr0VlFOPUWHKUgXrPmFQNi5K_pUykc,7622
commonmark/tests/unit_tests.py,sha256=f5F7gEs9ccbJb4hYAfdVHEuy7Gg6v3ZorOl-0jmqARc,4495

View file

@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.33.6)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

View file

@ -0,0 +1,3 @@
[console_scripts]
cmark = commonmark.cmark:main

View file

@ -0,0 +1 @@
commonmark