{"id":13814222,"url":"https://github.com/rolandshoemaker/CommonMark-py","last_synced_at":"2025-05-15T03:33:18.965Z","repository":{"id":20731095,"uuid":"24015294","full_name":"rolandshoemaker/CommonMark-py","owner":"rolandshoemaker","description":"Depreciated in favor of rtfd/CommonMark-py","archived":false,"fork":false,"pushed_at":"2021-09-03T22:09:50.000Z","size":427,"stargazers_count":125,"open_issues_count":17,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T20:05:36.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rolandshoemaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-14T06:34:19.000Z","updated_at":"2024-04-17T21:19:10.000Z","dependencies_parsed_at":"2022-09-11T02:23:13.657Z","dependency_job_id":null,"html_url":"https://github.com/rolandshoemaker/CommonMark-py","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolandshoemaker%2FCommonMark-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolandshoemaker%2FCommonMark-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolandshoemaker%2FCommonMark-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolandshoemaker%2FCommonMark-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rolandshoemaker","download_url":"https://codeload.github.com/rolandshoemaker/CommonMark-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254266518,"owners_count":22042123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T04:01:47.664Z","updated_at":"2025-05-15T03:33:18.639Z","avatar_url":"https://github.com/rolandshoemaker.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"CommonMark-py\n=============\n\n**NOTE:** This repo is no longer maintained and most likely contains numerous bugs, for the up to date and safe version you want [`rtfd/CommonMark-py`](https://github.com/rtfd/CommonMark-py).\n\nPure Python port of [jgm](https://github.com/jgm)'s [stmd.js](https://github.com/jgm/stmd/blob/master/js/stmd.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 `stmd.js`.\n\nWe are currently at the same development stage (actually a bit ahead because we have implemented HTML entity conversion and href URL escaping) as `stmd.js`. Since Python versions pre-3.4 use outdated (i.e. not HTML5 spec) entity conversion, I've converted the 3.4 implementation into a single file, `entitytrans.py` which so far seems to work (all tests pass on 2.7, 3.3, 3.4, PyPy, and PyPy3).\n\n**Current version:** 0.5.4\n\n[![Build Status](https://travis-ci.org/rolandshoemaker/CommonMark-py.svg?branch=master)](https://travis-ci.org/rolandshoemaker/CommonMark-py)\n\nInstallation\n------------\n\n    rolands@kamaji:~$ pip install commonmark\n\nUsage\n-----\n\n\timport CommonMark\n\tparser = CommonMark.DocParser()\n\trenderer = CommonMark.HTMLRenderer()\n\tast = parser.parse(\"Hello *World*\")\n\thtml = renderer.render(ast)\n\tjson = CommonMark.ASTtoJSON(ast)\n\tCommonMark.dumpAST(ast) # pretty print generated AST structure\n\tprint(html) # \u003cp\u003eHello \u003cem\u003eWorld\u003c/em\u003e\u003cp/\u003e\n    \n    ----- or -----\n    \n\trolands@kamaji:~$ cmark.py README.md -o README.html\n\trolands@kamaji:~$ cmark.py README.md -o README.json -aj # output AST as JSON\n\trolands@kamaji:~$ cmark.py README.md -a # pretty print generated AST structure\n\trolands@kamaji:~$ cmark.py -h\n\tusage: cmark.py [-h] [-o [O]] [-a] [-aj] [infile]\n\n\tProcess Markdown according to the CommonMark specification.\n\n\tpositional arguments:\n\t  infile      Input Markdown file to parse, defaults to stdin\n\n\toptional arguments:\n\t  -h, --help  show this help message and exit\n\t  -o [O]      Output HTML/JSON file, defaults to stdout\n\t  -a          Print formatted AST\n\t  -aj         Output JSON AST\n\t \nContributing\n------------\n\nIf 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 [stmd.js](https://github.com/jgm/stmd/blob/master/js/stmd.js) project a pull request adding your test to the existing test suite.\n\nTests\n-----\n\nThe tests script, `CommonMark-tests.py`, is pretty much a devtool. As well as running all the tests embeded 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 inputing a line with just `end`, to quit do the same but with `quit`). `-d` can be used to print call tracing.\n\n\trolands@kamaji:~/utils/CommonMark-py$ python CommonMark-tests.py -h\n\tusage: CommonMark-tests.py [-h] [-t T] [-p] [-f] [-i] [-d] [-np] [-s]\n\n\tscript to run the CommonMark specification tests against the CommonMark.py\n\tparser\n\n\toptional arguments:\n\t  -h, --help  show this help message and exit\n\t  -t T        Single test to run or comma seperated list of tests (-t 10 or -t 10,11,12,13)\n\t  -p          Print passed test information\n\t  -f          Print failed tests (during -np...)\n\t  -i          Interactive Markdown input mode\n\t  -d          Debug, trace calls\n\t  -np         Only print section header, tick, or cross\n\t  -s          Print percent of tests passed by category\n\nAuthors\n-------\n* [Bibek Kafle](https://github.com/kafle)\n* [Roland Shoemaker](https://github.com/rolandshoemaker)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolandshoemaker%2FCommonMark-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frolandshoemaker%2FCommonMark-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolandshoemaker%2FCommonMark-py/lists"}