commonmark-socialhome


Namecommonmark-socialhome JSON
Version 0.9.1.post2 PyPI version JSON
download
home_page
SummaryPython parser for the CommonMark Markdown spec, Socialhome fork
upload_time2024-01-22 22:02:42
maintainer
docs_urlNone
author
requires_python>=3.8
licenseCopyright (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.
keywords markup markdown commonmark
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            commonmark.py socialhome
========================

Socialhome fork of https://github.com/readthedocs/commonmark.py

Tested on Python 3.8 - 3.10.

Fork changes
------------

* `Allow ignoring HTML blocks <https://github.com/jaywink/commonmark.py/commit/7ba4bac05d5ccef4a029e49935f8fd68772a266f>`_

Installation
------------

::

    $ pip install commonmark-socialhome

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "commonmark-socialhome",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Jason Robinson <mail@jasonrobinson.me>",
    "keywords": "markup,markdown,commonmark",
    "author": "",
    "author_email": "Bibek Kafle <bkafle662@gmail.com>, Roland Shoemaker <rolandshoemaker@gmail.com>, Jason Robinson <mail@jasonrobinson.me>",
    "download_url": "https://files.pythonhosted.org/packages/b0/74/6747a8b2c2592d952e4d91a5014f2bf919801bf3ed11b83e8a01ac37f8cb/commonmark_socialhome-0.9.1.post2.tar.gz",
    "platform": null,
    "description": "commonmark.py socialhome\n========================\n\nSocialhome fork of https://github.com/readthedocs/commonmark.py\n\nTested on Python 3.8 - 3.10.\n\nFork changes\n------------\n\n* `Allow ignoring HTML blocks <https://github.com/jaywink/commonmark.py/commit/7ba4bac05d5ccef4a029e49935f8fd68772a266f>`_\n\nInstallation\n------------\n\n::\n\n    $ pip install commonmark-socialhome\n\nUsage\n-----\n\n::\n\n    >>> import commonmark\n    >>> commonmark.commonmark('*hello!*')\n    '<p><em>hello!</em></p>\\n'\n\nOr, without the syntactic sugar:\n\n.. code:: python\n\n    import commonmark\n    parser = commonmark.Parser()\n    ast = parser.parse(\"Hello *World*\")\n\n    renderer = commonmark.HtmlRenderer()\n    html = renderer.render(ast)\n    print(html) # <p>Hello <em>World</em><p/>\n\n    # inspecting the abstract syntax tree\n    json = commonmark.dumpJSON(ast)\n    commonmark.dumpAST(ast) # pretty print generated AST structure\n\nThere is also a CLI:\n\n::\n\n    $ cmark README.md -o README.html\n    $ cmark README.md -o README.json -aj # output AST as JSON\n    $ cmark README.md -a # pretty print generated AST structure\n    $ cmark -h\n    usage: cmark [-h] [-o [O]] [-a] [-aj] [infile]\n\n    Process Markdown according to the CommonMark specification.\n\n    positional arguments:\n      infile      Input Markdown file to parse, defaults to stdin\n\n    optional arguments:\n      -h, --help  show this help message and exit\n      -o [O]      Output HTML/JSON file, defaults to stdout\n      -a          Print formatted AST\n      -aj         Output JSON AST\n\n\nContributing\n------------\n\nIf you would like to offer suggestions/optimizations/bugfixes through\npull requests please do! Also if you find an error in the\nparser/renderer that isn't caught by the current test suite please open\na new issue and I would also suggest you send the\n`commonmark.js <https://github.com/jgm/commonmark.js>`__ project\na pull request adding your test to the existing test suite.\n\nTests\n-----\n\nTo work on commonmark.py, you will need to be able to run the test suite to\nmake sure your changes don't break anything. To run the tests, you can do\nsomething like this:\n\n::\n\n   $ pyvenv venv\n   $ ./venv/bin/python setup.py develop test\n\nThe tests script, ``commonmark/tests/run_spec_tests.py``, is pretty much a devtool. As\nwell as running all the tests embedded in ``spec.txt`` it also allows you\nto run specific tests using the ``-t`` argument, provide information\nabout passed tests with ``-p``, percentage passed by category of test\nwith ``-s``, and enter markdown interactively with ``-i`` (In\ninteractive mode end a block by inputting a line with just ``end``, to\nquit do the same but with ``quit``). ``-d`` can be used to print call\ntracing.\n\n::\n\n    $ ./venv/bin/python commonmark/tests/run_spec_tests.py -h\n    usage: run_spec_tests.py [-h] [-t T] [-p] [-f] [-i] [-d] [-np] [-s]\n\n    script to run the CommonMark specification tests against the commonmark.py\n    parser.\n\n    optional arguments:\n      -h, --help  show this help message and exit\n      -t T        Single test to run or comma separated list of tests (-t 10 or -t 10,11,12,13)\n      -p          Print passed test information\n      -f          Print failed tests (during -np...)\n      -i          Interactive Markdown input mode\n      -d          Debug, trace calls\n      -np         Only print section header, tick, or cross\n      -s          Print percent of tests passed by category\n",
    "bugtrack_url": null,
    "license": "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.",
    "summary": "Python parser for the CommonMark Markdown spec, Socialhome fork",
    "version": "0.9.1.post2",
    "project_urls": {
        "Homepage": "https://github.com/jaywink/commonmark.py",
        "Issues": "https://github.com/jaywink/commonmark.py/issues"
    },
    "split_keywords": [
        "markup",
        "markdown",
        "commonmark"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0df0c161a5377e059048438b0a3bca3093ac4631bc7e19c16db383ba4efb884c",
                "md5": "7f4a47cb64ec6ea71996cd9adf67b890",
                "sha256": "0776b3b3a98cd9a37c472c6ae56536c31c76ac89d620c5c6387fd0e639d03353"
            },
            "downloads": -1,
            "filename": "commonmark_socialhome-0.9.1.post2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f4a47cb64ec6ea71996cd9adf67b890",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 51783,
            "upload_time": "2024-01-22T22:02:39",
            "upload_time_iso_8601": "2024-01-22T22:02:39.051777Z",
            "url": "https://files.pythonhosted.org/packages/0d/f0/c161a5377e059048438b0a3bca3093ac4631bc7e19c16db383ba4efb884c/commonmark_socialhome-0.9.1.post2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b0746747a8b2c2592d952e4d91a5014f2bf919801bf3ed11b83e8a01ac37f8cb",
                "md5": "88be60ad85d805117a432f06132d2d55",
                "sha256": "9670f94fc30d929c51dc08c3d4218905e2725fca7ca9c82975f4099564af61b5"
            },
            "downloads": -1,
            "filename": "commonmark_socialhome-0.9.1.post2.tar.gz",
            "has_sig": false,
            "md5_digest": "88be60ad85d805117a432f06132d2d55",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 96793,
            "upload_time": "2024-01-22T22:02:42",
            "upload_time_iso_8601": "2024-01-22T22:02:42.263821Z",
            "url": "https://files.pythonhosted.org/packages/b0/74/6747a8b2c2592d952e4d91a5014f2bf919801bf3ed11b83e8a01ac37f8cb/commonmark_socialhome-0.9.1.post2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-22 22:02:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaywink",
    "github_project": "commonmark.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "commonmark-socialhome"
}
        
Elapsed time: 0.16734s