cmark
TOC »
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.
- cmark->sxml sprocedure
Convert markdown string to sxml. Useful if you want to use sxml as an intermediate format and programmatically manipulate the document structure.
- cmark->html input #!key (safe? t)procedure
Convert commonmark markdown string to html string.
- commonmark->html input #!key (safe? t)procedure
Alias for cmark->html.
Low Level Procedures
The rest of the api is for more advanced use cases like writing your own commonmark renderer.
- cmark-parse-document c-string size optionsprocedure
Reads in a string and converts it to a cmark document object or cmark-node.
- cmark-render-xml cmark-node-pointer optionsprocedure
Renders a cmark document to an xml string.
- cmark-render-html cmark-node-pointer optionsprocedure
Renders a cmark document to an html string.
- cmark-render-man cmark-node-pointer int-num optionsprocedure
Renders a cmark document to a manpage string.
- cmark-render-commonmark cmark-node-pointer int-num optionsprocedure
Renders a cmark document to commonmark markdown string.
- cmark-render-latex cmark-node-pointer int-num optionsprocedure
Renders a cmark document to latex string.
- cmark-markdown-to-html markdown content-length optionsprocedure
Renders commonmark string to html string. commonmark->html abstracts over this function.
- cmark-node-free cmark-node-pointerprocedure
- cmark-node-next cmark-node-pointerprocedure
- cmark-node-previous cmark-node-pointerprocedure
- cmark-node-parent cmark-node-pointerprocedure
- cmark-node-first-child cmark-node-pointerprocedure
- cmark-node-last-child cmark-node-pointerprocedure
- cmark-node-get-user-data cmark-node-pointerprocedure
- cmark-node-get-type cmark-node-pointerprocedure
- cmark-node-get-type-string cmark-node-pointerprocedure
- cmark-node-get-literal cmark-node-pointerprocedure
- cmark-node-set-literal cmark-node-pointer c-stringprocedure
- cmark-node-get-heading-level cmark-node-pointerprocedure
- cmark-node-set-heading-level cmark-node-pointer int-numprocedure
- cmark-node-get-list-type cmark-node-pointerprocedure
- cmark-node-set-list-type cmark-node-pointer int-numprocedure
- cmark-node-get-list-delim cmark-node-pointerprocedure
- cmark-node-set-list-delim cmark-node-pointer int-numprocedure
- cmark-node-get-list-start cmark-node-pointerprocedure
- cmark-node-set-list-start cmark-node-pointer int-numprocedure
- cmark-node-get-list-tight cmark-node-pointerprocedure
- cmark-node-set-list-tight cmark-node-pointer int-numprocedure
- cmark-node-get-fence-info cmark-node-pointerprocedure
- cmark-node-set-fence-info cmark-node-pointer c-stringprocedure
- cmark-node-get-url cmark-node-pointerprocedure
- cmark-node-set-url cmark-node-pointer c-stringprocedure
- cmark-node-get-title cmark-node-pointerprocedure
- cmark-node-set-title cmark-node-pointer c-stringprocedure
- cmark-node-get-on-enter cmark-node-pointerprocedure
- cmark-node-set-on-enter cmark-node-pointer c-stringprocedure
- cmark-node-get-on-exit cmark-node-pointerprocedure
- cmark-node-set-on-exit cmark-node-pointer c-stringprocedure
- cmark-node-get-start-line cmark-node-pointerprocedure
- cmark-node-get-start-column cmark-node-pointerprocedure
- cmark-node-end-line cmark-node-pointerprocedure
- cmark-node-end-column cmark-node-pointerprocedure
- cmark-node-unlink cmark-node-pointerprocedure
- cmark-node-insert-before cmark-node-pointer-a cmark-node-pointer-bprocedure
- cmark-node-insert-after cmark-node-pointer-a cmark-node-pointer-bprocedure
- cmark-node-replace cmark-node-pointer-a cmark-node-pointer-bprocedure
- cmark-node-prepend-child cmark-node-pointer-a cmark-node-pointer-bprocedure
- cmark-node-append-child cmark-node-pointer-a cmark-node-pointer-bprocedure
- cmark-consolidate-text-nodes cmark-node-pointerprocedure
- cmark-iter-new cmark-node-pointerprocedure
- cmark-iter-free cmark-node-iter-pointerprocedure
- cmark-iter-next cmark-node-iter-pointerprocedure
- cmark-iter-get-node cmark-node-iter-pointerprocedure
- cmark-iter-get-event-type cmark-node-iter-pointerprocedure
- cmark-iter-get-root cmark-node-iter-pointerprocedure
- cmark-iter-reset cmark-node-iter-pointerprocedure
- cmark-parser-new int-numprocedure
- cmark-parser-free cmark-parser-pointerprocedure
- cmark-parser-feed cmark-parser-pointer c-string sizeprocedure
- cmark-parser-finish cmark-parser-pointerprocedure
- cmark-parse-file fileprocedure
- cmark-versionprocedure
- cmark-version-stringprocedure
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_SAFEconstant
- CMARK_OPT_DEFAULTconstant
- CMARK_EVENT_NONEconstant
- CMARK_EVENT_DONEconstant
- CMARK_EVENT_ENTERconstant
- CMARK_EVENT_EXITconstant
- CMARK_NODE_NONEconstant
- CMARK_NODE_DOCUMENTconstant
- CMARK_NODE_BLOCK_QUOTEconstant
- CMARK_NODE_LISTconstant
- CMARK_NODE_ITEMconstant
- CMARK_NODE_CODE_BLOCKconstant
- CMARK_NODE_HTML_BLOCKconstant
- CMARK_NODE_CUSTOM_BLOCKconstant
- CMARK_NODE_PARAGRAPHconstant
- CMARK_NODE_HEADINGconstant
- CMARK_NODE_THEMATIC_BREAKconstant
- CMARK_NODE_FIRST_BLOCKconstant
- CMARK_NODE_LAST_BLOCKconstant
- CMARK_NODE_TEXTconstant
- CMARK_NODE_SOFTBREAKconstant
- CMARK_NODE_LINEBREAKconstant
- CMARK_NODE_CODEconstant
- CMARK_NODE_HTML_INLINEconstant
- CMARK_NODE_CUSTOM_INLINEconstant
- CMARK_NODE_EMPHconstant
- CMARK_NODE_STRONGconstant
- CMARK_NODE_LINKconstant
- CMARK_NODE_IMAGEconstant
- CMARK_NODE_FIRST_INLINEconstant
- CMARK_NODE_LAST_INLINEconstant
- CMARK_NO_LISTconstant
- CMARK_BULLET_LISTconstant
- CMARK_ORDERED_LISTconstant
- CMARK_NO_DELIMconstant
- CMARK_PERIOD_DELIMconstant
- CMARK_PAREN_DELIMconstant
Source Code / Issues
https://git.sr.ht/~fancycade/chicken-cmark
License
MIT
Releases
0.1.0 Initial release for Chicken 5