cmark
Description
This egg is a wrapper for the native commonmark library. It includes markdown to sxml capabilities and can function as a drop-in replacement for lowdown with higher performance.
The cmark->sxml tests use the entire Markdown Testsuite to verify correctness. As a consequence of this, cmark does not generate the exact sxml as lowdown. One could argue cmark's sxml is better than lowdown's.
This is an entirely new codebase from the Chicken 4 version of cmark. However, aliases have been provided to make this egg backwards compatible when upgrading from Chicken 4 to Chicken 5.
API
High Level Procedures
For most common use cases, you'll need cmark->sxml and cmark->html.
[procedure] (cmark->sxml s)
Convert markdown string to sxml. Useful if you want to use sxml as an intermediate format and programmatically manipulate the document structure.
[procedure] (cmark->html input #!key (safe? t))
Convert commonmark markdown string to html string.
[procedure] (commonmark->html input #!key (safe? t))
Alias for cmark->html.
Low Level Procedures
The rest of the api is for more advanced use cases like writing your own commonmark renderer.
[procedure] (cmark-parse-document c-string size options)
Reads in a string and converts it to a cmark document object or cmark-node.
[procedure] (cmark-render-xml cmark-node-pointer options)
Renders a cmark document to an xml string.
[procedure] (cmark-render-html cmark-node-pointer options)
Renders a cmark document to an html string.
[procedure] (cmark-render-man cmark-node-pointer int-num options)
Renders a cmark document to a manpage string.
[procedure] (cmark-render-commonmark cmark-node-pointer int-num options)
Renders a cmark document to commonmark markdown string.
[procedure] (cmark-render-latex cmark-node-pointer int-num options)
Renders a cmark document to latex string.
[procedure] (cmark-markdown-to-html markdown content-length options)
Renders commonmark string to html string. commonmark->html abstracts over this function.
(cmark-node-free cmark-node-pointer)(cmark-node-next cmark-node-pointer)(cmark-node-previous cmark-node-pointer)(cmark-node-parent cmark-node-pointer)(cmark-node-first-child cmark-node-pointer)(cmark-node-last-child cmark-node-pointer)(cmark-node-get-user-data cmark-node-pointer)(cmark-node-get-type cmark-node-pointer)(cmark-node-get-type-string cmark-node-pointer)(cmark-node-get-literal cmark-node-pointer)(cmark-node-set-literal cmark-node-pointer c-string)(cmark-node-get-heading-level cmark-node-pointer)(cmark-node-set-heading-level cmark-node-pointer int-num)(cmark-node-get-list-type cmark-node-pointer)(cmark-node-set-list-type cmark-node-pointer int-num)(cmark-node-get-list-delim cmark-node-pointer)(cmark-node-set-list-delim cmark-node-pointer int-num)(cmark-node-get-list-start cmark-node-pointer)(cmark-node-set-list-start cmark-node-pointer int-num)(cmark-node-get-list-tight cmark-node-pointer)(cmark-node-set-list-tight cmark-node-pointer int-num)(cmark-node-get-fence-info cmark-node-pointer)(cmark-node-set-fence-info cmark-node-pointer c-string)(cmark-node-get-url cmark-node-pointer)(cmark-node-set-url cmark-node-pointer c-string)(cmark-node-get-title cmark-node-pointer)(cmark-node-set-title cmark-node-pointer c-string)(cmark-node-get-on-enter cmark-node-pointer)(cmark-node-set-on-enter cmark-node-pointer c-string)(cmark-node-get-on-exit cmark-node-pointer)(cmark-node-set-on-exit cmark-node-pointer c-string)(cmark-node-get-start-line cmark-node-pointer)(cmark-node-get-start-column cmark-node-pointer)(cmark-node-end-line cmark-node-pointer)(cmark-node-end-column cmark-node-pointer)(cmark-node-unlink cmark-node-pointer)(cmark-node-insert-before cmark-node-pointer-a cmark-node-pointer-b)(cmark-node-insert-after cmark-node-pointer-a cmark-node-pointer-b)(cmark-node-replace cmark-node-pointer-a cmark-node-pointer-b)(cmark-node-prepend-child cmark-node-pointer-a cmark-node-pointer-b)(cmark-node-append-child cmark-node-pointer-a cmark-node-pointer-b)(cmark-consolidate-text-nodes cmark-node-pointer)(cmark-iter-new cmark-node-pointer)(cmark-iter-free cmark-node-iter-pointer)(cmark-iter-next cmark-node-iter-pointer)(cmark-iter-get-node cmark-node-iter-pointer)(cmark-iter-get-event-type cmark-node-iter-pointer)(cmark-iter-get-root cmark-node-iter-pointer)(cmark-iter-reset cmark-node-iter-pointer)(cmark-parser-new int-num)(cmark-parser-free cmark-parser-pointer)(cmark-parser-feed cmark-parser-pointer c-string size)(cmark-parser-finish cmark-parser-pointer)[procedure] (cmark-parse-file file)
(cmark-version)(cmark-version-string)Constants
All commonmark constants are exported as well. They are mostly useful internally, but are necessary if writing a new cmark export format. The variables keep the C style formatting from the commonmark library.
CMARK_OPT_SAFECMARK_OPT_DEFAULTCMARK_EVENT_NONECMARK_EVENT_DONECMARK_EVENT_ENTERCMARK_EVENT_EXITCMARK_NODE_NONECMARK_NODE_DOCUMENTCMARK_NODE_BLOCK_QUOTECMARK_NODE_LISTCMARK_NODE_ITEMCMARK_NODE_CODE_BLOCKCMARK_NODE_HTML_BLOCKCMARK_NODE_CUSTOM_BLOCKCMARK_NODE_PARAGRAPHCMARK_NODE_HEADINGCMARK_NODE_THEMATIC_BREAKCMARK_NODE_FIRST_BLOCKCMARK_NODE_LAST_BLOCKCMARK_NODE_TEXTCMARK_NODE_SOFTBREAKCMARK_NODE_LINEBREAKCMARK_NODE_CODECMARK_NODE_HTML_INLINECMARK_NODE_CUSTOM_INLINECMARK_NODE_EMPHCMARK_NODE_STRONGCMARK_NODE_LINKCMARK_NODE_IMAGECMARK_NODE_FIRST_INLINECMARK_NODE_LAST_INLINECMARK_NO_LISTCMARK_BULLET_LISTCMARK_ORDERED_LISTCMARK_NO_DELIMCMARK_PERIOD_DELIMCMARK_PAREN_DELIMSource Code / Issues
https://git.sr.ht/~fancycade/chicken-cmark
License
MIT
Releases
0.1.0 Initial release for Chicken 5