Public API

Structures

cmark_llistA generic singly linked list.
cmark_memDefines the memory allocation functions to be used by CMark when parsing and allocating a document tree

Functions

cmark_arena_resetResets the arena allocator, quickly returning all used memory to the operating system.
cmark_consolidate_text_nodesConsolidates adjacent text nodes.
cmark_get_arena_mem_allocatorAn arena allocator; uses system calloc to allocate large slabs of memory
cmark_get_default_mem_allocatorThe default memory allocator; uses the system's calloc, realloc and free.
cmark_iter_freeFrees the memory allocated for an iterator.
cmark_iter_get_event_typeReturns the current event type.
cmark_iter_get_nodeReturns the current node.
cmark_iter_get_rootReturns the root node.
cmark_iter_newCreates a new iterator starting at 'root'
cmark_iter_nextAdvances to the next node and returns the event type (CMARK_EVENT_ENTER, CMARK_EVENT_EXIT or CMARK_EVENT_DONE).
cmark_iter_resetResets the iterator so that the current node is 'current' and the event type is 'event_type'
cmark_llist_appendAppend an element to the linked list, return the possibly modified head of the list.
cmark_llist_freeFree the list starting with 'head'
cmark_llist_free_fullFree the list starting with 'head', calling 'free_func' with the data pointer of each of its elements
cmark_markdown_to_htmlcmark-gfm - CommonMark parsing, manipulating, and rendering
cmark_node_append_childAdds 'child' to the end of the children of 'node'
cmark_node_first_childReturns the first child of 'node', or NULL if 'node' has no children.
cmark_node_freeFrees the memory allocated for a node and any children.
cmark_node_get_end_columnReturns the column at which 'node' ends.
cmark_node_get_end_lineReturns the line on which 'node' ends.
cmark_node_get_fence_infoReturns the info string from a fenced code block.
cmark_node_get_fencedReturns code blocks fencing details
cmark_node_get_heading_levelReturns the heading level of 'node', or 0 if 'node' is not a heading.
cmark_node_get_list_delimReturns the list delimiter type of 'node', or CMARK_NO_DELIM if 'node' is not a list.
cmark_node_get_list_startReturns starting number of 'node', if it is an ordered list, otherwise 0.
cmark_node_get_list_tightReturns 1 if 'node' is a tight list, 0 otherwise.
cmark_node_get_list_typeReturns the list type of 'node', or CMARK_NO_LIST if 'node' is not a list.
cmark_node_get_literalReturns the string contents of 'node', or an empty string if none is set
cmark_node_get_on_enterReturns the literal "on enter" text for a custom 'node', or an empty string if no on_enter is set
cmark_node_get_on_exitReturns the literal "on exit" text for a custom 'node', or an empty string if no on_exit is set
cmark_node_get_start_columnReturns the column at which 'node' begins.
cmark_node_get_start_lineReturns the line on which 'node' begins.
cmark_node_get_titleReturns the title of a link or image 'node', or an empty string if no title is set
cmark_node_get_typeReturns the type of 'node', or CMARK_NODE_NONE on error.
cmark_node_get_type_stringLike 'cmark_node_get_type', but returns a string representation of the type, or "<unknown>".
cmark_node_get_urlReturns the URL of a link or image 'node', or an empty string if no URL is set
cmark_node_get_user_dataReturns the user data of 'node'.
cmark_node_insert_afterInserts 'sibling' after 'node'
cmark_node_insert_beforeInserts 'sibling' before 'node'
cmark_node_last_childReturns the last child of 'node', or NULL if 'node' has no children.
cmark_node_newCreates a new node of type 'type'
cmark_node_new_with_ext
cmark_node_new_with_memSame as cmark_node_new, but explicitly listing the memory allocator used to allocate the node
cmark_node_new_with_mem_and_ext
cmark_node_nextReturns the next node in the sequence after 'node', or NULL if there is none.
cmark_node_ownEnsures a node and all its children own their own chunk memory.
cmark_node_parentReturns the parent of 'node', or NULL if there is none.
cmark_node_prepend_childAdds 'child' to the beginning of the children of 'node'
cmark_node_previousReturns the previous node in the sequence after 'node', or NULL if there is none.
cmark_node_replaceReplaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does not free its memory)
cmark_node_set_fence_infoSets the info string in a fenced code block, returning 1 on success and 0 on failure.
cmark_node_set_fencedSets code blocks fencing details
cmark_node_set_heading_levelSets the heading level of 'node', returning 1 on success and 0 on error.
cmark_node_set_list_delimSets the list delimiter type of 'node', returning 1 on success and 0 on error.
cmark_node_set_list_startSets starting number of 'node', if it is an ordered list
cmark_node_set_list_tightSets the "tightness" of a list
cmark_node_set_list_typeSets the list type of 'node', returning 1 on success and 0 on error.
cmark_node_set_literalSets the string contents of 'node'
cmark_node_set_on_enterSets the literal text to render "on enter" for a custom 'node'
cmark_node_set_on_exitSets the literal text to render "on exit" for a custom 'node'
cmark_node_set_titleSets the title of a link or image 'node'
cmark_node_set_urlSets the URL of a link or image 'node'
cmark_node_set_user_dataSets arbitrary user data for 'node'
cmark_node_set_user_data_free_funcSet free function for user data
cmark_parse_documentParse a CommonMark document in 'buffer' of length 'len'
cmark_parse_fileParse a CommonMark document in file 'f', returning a pointer to a tree of nodes
cmark_parser_feedFeeds a string of length 'len' to 'parser'.
cmark_parser_finishFinish parsing and return a pointer to a tree of nodes.
cmark_parser_freeFrees memory allocated for a parser object.
cmark_parser_newSimple interface:
cmark_parser_new_with_memCreates a new parser object with the given memory allocator
cmark_render_commonmarkRender a 'node' tree as a commonmark document
cmark_render_commonmark_with_memAs for 'cmark_render_commonmark', but specifying the allocator to use for the resulting string.
cmark_render_htmlRender a 'node' tree as an HTML fragment
cmark_render_html_with_memAs for 'cmark_render_html', but specifying the allocator to use for the resulting string.
cmark_render_latexRender a 'node' tree as a LaTeX document
cmark_render_latex_with_memAs for 'cmark_render_latex', but specifying the allocator to use for the resulting string.
cmark_render_manRender a 'node' tree as a groff man page, without the header
cmark_render_man_with_memAs for 'cmark_render_man', but specifying the allocator to use for the resulting string.
cmark_render_plaintextRender a 'node' tree as a plain text document
cmark_render_plaintext_with_memAs for 'cmark_render_plaintext', but specifying the allocator to use for the resulting string.
cmark_render_xmlRender a 'node' tree as XML
cmark_render_xml_with_memAs for 'cmark_render_xml', but specifying the allocator to use for the resulting string.
cmark_versionThe library version as integer for runtime checks
cmark_version_stringThe library version string for runtime checks

Enums

cmark_node_type

Mentioned in

cmark_list_type

Mentioned in

cmark_delim_type

Mentioned in

cmark_event_typeAn iterator will walk through a tree of nodes, starting from a root node, returning one node at a time, together with information about whether the node is being entered or exited

Defines

Defines (cmark-gfm.h)

CMARK_NODE_TYPE_PRESENT (0x8000)

Node Structure

CMARK_NODE_TYPE_BLOCK (CMARK_NODE_TYPE_PRESENT | 0x0000)

Mentioned in:

CMARK_NODE_TYPE_INLINE (CMARK_NODE_TYPE_PRESENT | 0x4000)

Mentioned in:

CMARK_NODE_TYPE_MASK (0xc000)

CMARK_NODE_VALUE_MASK (0x3fff)

CMARK_NODE_HEADER CMARK_NODE_HEADING

Mentioned in:

CMARK_NODE_HRULE CMARK_NODE_THEMATIC_BREAK

Mentioned in:

CMARK_NODE_HTML CMARK_NODE_HTML_BLOCK

CMARK_NODE_INLINE_HTML CMARK_NODE_HTML_INLINE

cmark_node_get_header_level cmark_node_get_heading_level

Mentioned in:

cmark_node_set_header_level cmark_node_set_heading_level

Mentioned in:

CMARK_OPT_DEFAULT 0

Options

Default options.

Mentioned in:

Man Page 3 / Parsing

Man Page 3 / Options

Basic Tutorial / Changelog

CMARK_OPT_SOURCEPOS (1 << 1)

Options affecting rendering

Include a data-sourcepos attribute on all block elements.

Mentioned in:

Man Page 3 / Options affecting rendering

CMARK_OPT_HARDBREAKS (1 << 2)

Render softbreak elements as hard line breaks.

Mentioned in:

Man Page 3 / Options affecting rendering

Basic Tutorial / Changelog

CMARK_OPT_SAFE (1 << 3)

CMARK_OPT_SAFE is defined here for API compatibility, but it no longer has any effect. "Safe" mode is now the default: set CMARK_OPT_UNSAFE to disable it.

Mentioned in:

Man Page 3 / Options affecting rendering

Basic Tutorial / Changelog

CMARK_OPT_UNSAFE (1 << 17)

Render raw HTML and unsafe links (javascript:, vbscript:, file:, and data:, except for image/png, image/gif, image/jpeg, or image/webp mime types). By default, raw HTML is replaced by a placeholder HTML comment. Unsafe links are replaced by empty strings.

Mentioned in:

Getting Started / Security

Man Page 3 / Options affecting rendering

Basic Tutorial / Changelog

CMARK_OPT_NOBREAKS (1 << 4)

Render softbreak elements as spaces.

Mentioned in:

Man Page 3 / Options affecting rendering

Basic Tutorial / Changelog

CMARK_OPT_NORMALIZE (1 << 8)

Options affecting parsing

Legacy option (no effect).

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_VALIDATE_UTF8 (1 << 9)

Validate UTF-8 in the input before parsing, replacing illegal sequences with the replacement character U+FFFD.

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_SMART (1 << 10)

Convert straight quotes to curly, — to em dashes, – to en dashes.

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_GITHUB_PRE_LANG (1 << 11)

Use GitHub-style

 tags for code blocks instead of 
.
Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_LIBERAL_HTML_TAG (1 << 12)

Be liberal in interpreting inline HTML tags.

Mentioned in:

Man Page 3 / Options affecting parsing

CMARK_OPT_FOOTNOTES (1 << 13)

Parse footnotes.

Mentioned in:

Man Page 3 / Options affecting parsing

CMARK_OPT_STRIKETHROUGH_DOUBLE_TILDE (1 << 14)

Only parse strikethroughs if surrounded by exactly 2 tildes. Gives some compatibility with redcarpet.

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_TABLE_PREFER_STYLE_ATTRIBUTES (1 << 15)

Use style attributes to align table cells instead of align attributes.

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

CMARK_OPT_FULL_INFO_STRING (1 << 16)

Include the remainder of the info string in code blocks in a separate attribute.

Mentioned in:

Man Page 3 / Options affecting parsing

Basic Tutorial / Changelog

NODE_DOCUMENT CMARK_NODE_DOCUMENT

AUTHORS

John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.

NODE_BLOCK_QUOTE CMARK_NODE_BLOCK_QUOTE

NODE_LIST CMARK_NODE_LIST

NODE_ITEM CMARK_NODE_ITEM

NODE_CODE_BLOCK CMARK_NODE_CODE_BLOCK

NODE_HTML_BLOCK CMARK_NODE_HTML_BLOCK

Mentioned in:

NODE_CUSTOM_BLOCK CMARK_NODE_CUSTOM_BLOCK

NODE_PARAGRAPH CMARK_NODE_PARAGRAPH

NODE_HEADING CMARK_NODE_HEADING

NODE_HEADER CMARK_NODE_HEADER

NODE_THEMATIC_BREAK CMARK_NODE_THEMATIC_BREAK

NODE_HRULE CMARK_NODE_HRULE

NODE_TEXT CMARK_NODE_TEXT

NODE_SOFTBREAK CMARK_NODE_SOFTBREAK

NODE_LINEBREAK CMARK_NODE_LINEBREAK

NODE_CODE CMARK_NODE_CODE

NODE_HTML_INLINE CMARK_NODE_HTML_INLINE

Mentioned in:

NODE_CUSTOM_INLINE CMARK_NODE_CUSTOM_INLINE

NODE_EMPH CMARK_NODE_EMPH

NODE_STRONG CMARK_NODE_STRONG

NODE_IMAGE CMARK_NODE_IMAGE

BULLET_LIST CMARK_BULLET_LIST

ORDERED_LIST CMARK_ORDERED_LIST

PERIOD_DELIM CMARK_PERIOD_DELIM

PAREN_DELIM CMARK_PAREN_DELIM

Typedefs

Typedefs (cmark-gfm.h)

typedef void(* cmark_free_func)(cmark_mem *mem, void *user_data)

Callback for freeing user data with a 'cmark_mem' context.

Mentioned in:

Man Page 3 / Custom memory allocator support

Man Page 3 / Linked list

Man Page 3 / Accessors

typedef int32_t bufsize_t

Mentioned in:

Variables

Variables (cmark-gfm.h)

cmark_node_type CMARK_NODE_LAST_BLOCK

cmark_node_type CMARK_NODE_LAST_INLINE






Add Discussion as Guest

Log in