readthedocs/commonmark.py

Better API for humans

blfpd opened this issue · 1 comments

Having a simple API similar to markdown2:

>>> from CommonMark import commonmark
>>> commonmark("*boo!*")
'<p><em>boo!</em></p>\n'
>>> commonmark("*boo!*", format="json")
'{"last_line_blank": false, "open": false, "start_line": 1, "t": "Document", "tight": false, "end_line": 0, "children": [{"last_line_blank": false, "open": false, "start_line": 1, "t": "Paragraph", "inline_content": [{"last_line_blank": false, "open": true, "t": "Emph", "tight": false, "c": [{"last_line_blank": false, "open": true, "t": "Str", "tight": false, "c": "boo"}, {"last_line_blank": false, "open": true, "t": "Str", "tight": false, "c": "!"}]}], "tight": false, "strings": ["*boo!*"], "end_line": 0, "start_column": 1}], "start_column": 1}'

This was added in d5aea73