Resets the arena allocator, quickly returning all used memory
to the operating system.
Consolidates adjacent text nodes.
This will search for the syntax extension named ‘name’ among the
registered syntax extensions.
An arena allocator; uses system calloc to allocate large
slabs of memory. Memory in these slabs is not reused at all.
The default memory allocator; uses the system’s calloc,
realloc and free.
Advance the current inline parsing offset
Gets the cmark_chunk being operated on by the given inline parser.
Use cmark_inline_parser_get_offset to get our current position in the chunk.
Get the current inline parsing offset
Returns 1 if the inline parser is currently in a bracket; pass 1 for ‘image’
if you want to know about an image-type bracket, 0 for link-type.
Whether the inline parser has reached the end of the current line
Get the character located ‘pos’ bytes in the current line.
Get the character located at the current inline parsing offset
Remove ‘delim’ from the delimiter stack
Convenience function to scan a given delimiter.
Set the offset in bytes in the chunk being processed by the given inline parser.
Get the characters located after the current inline parsing offset
while ‘pred’ matches. Free after usage.
Frees the memory allocated for an iterator.
Returns the current event type.
Returns the current node.
Returns the root node.
Creates a new iterator starting at ‘root’. The current node and event
type are undefined until ‘cmark_iter_next’ is called for the first time.
The memory allocated for the iterator should be released using
‘cmark_iter_free’ when it is no longer needed.
Advances to the next node and returns the event type (CMARK_EVENT_ENTER
,
CMARK_EVENT_EXIT
or CMARK_EVENT_DONE
).
Resets the iterator so that the current node is ‘current’ and
the event type is ‘event_type’. The new current node must be a
descendant of the root node or the root node itself.
Append an element to the linked list, return the possibly modified
head of the list.
Free the list starting with ‘head’
Free the list starting with ‘head’, calling ‘free_func’ with the
data pointer of each of its elements
Convert ‘text’ (assumed to be a UTF-8 encoded string with length
‘len’) from CommonMark Markdown to HTML, returning a null-terminated,
UTF-8-encoded string. It is the caller’s responsibility
to free the returned buffer.
Adds ‘child’ to the end of the children of ‘node’.
Returns 1 on success, 0 on failure.
Returns the first child of ‘node’, or NULL if ‘node’ has no children.
Frees the memory allocated for a node and any children.
Returns the column at which ‘node’ ends.
Returns the line on which ‘node’ ends.
Returns the info string from a fenced code block.
Returns code blocks fencing details
Returns the heading level of ‘node’, or 0 if ‘node’ is not a heading.
Returns the list delimiter type of ‘node’, or CMARK_NO_DELIM
if ‘node’
is not a list.
Returns starting number of ‘node’, if it is an ordered list, otherwise 0.
Returns 1 if ‘node’ is a tight list, 0 otherwise.
Returns the list type of ‘node’, or CMARK_NO_LIST
if ‘node’
is not a list.
Returns the string contents of ‘node’, or an empty
string if none is set. Returns NULL if called on a
node that does not have string content.
Returns the literal “on enter” text for a custom ‘node’, or
an empty string if no on_enter is set. Returns NULL if called
on a non-custom node.
Returns the literal “on exit” text for a custom ‘node’, or
an empty string if no on_exit is set. Returns NULL if
called on a non-custom node.
Returns the column at which ‘node’ begins.
Returns the line on which ‘node’ begins.
Return the string content for all types of ‘node’.
The pointer stays valid as long as ‘node’ isn’t freed.
Get the syntax extension responsible for the creation of ‘node’.
Return NULL if ‘node’ was created because it matched standard syntax rules.
Returns the title of a link or image ‘node’, or an empty
string if no title is set. Returns NULL if called on a node
that is not a link or image.
Returns the type of ‘node’, or CMARK_NODE_NONE
on error.
Like ‘cmark_node_get_type’, but returns a string representation
of the type, or "<unknown>"
.
Returns the URL of a link or image ‘node’, or an empty string
if no URL is set. Returns NULL if called on a node that is
not a link or image.
Returns the user data of ‘node’.
Inserts ‘sibling’ after ‘node’. Returns 1 on success, 0 on failure.
Inserts ‘sibling’ before ‘node’. Returns 1 on success, 0 on failure.
Returns the last child of ‘node’, or NULL if ‘node’ has no children.
Creates a new node of type ‘type’. Note that the node may have
other required properties, which it is the caller’s responsibility
to assign.
Same as cmark_node_new
, but explicitly listing the memory
allocator used to allocate the node. Note: be sure to use the same
allocator for every node in a tree, or bad things can happen.
Returns the next node in the sequence after ‘node’, or NULL if
there is none.
Ensures a node and all its children own their own chunk memory.
Returns the parent of ‘node’, or NULL if there is none.
Adds ‘child’ to the beginning of the children of ‘node’.
Returns 1 on success, 0 on failure.
Returns the previous node in the sequence after ‘node’, or NULL if
there is none.
Replaces ‘oldnode’ with ‘newnode’ and unlinks ‘oldnode’ (but does
not free its memory).
Returns 1 on success, 0 on failure.
Sets the info string in a fenced code block, returning 1 on
success and 0 on failure.
Sets code blocks fencing details
Sets the heading level of ‘node’, returning 1 on success and 0 on error.
Sets the list delimiter type of ‘node’, returning 1 on success and 0
on error.
Sets starting number of ‘node’, if it is an ordered list. Returns 1
on success, 0 on failure.
Sets the “tightness” of a list. Returns 1 on success, 0 on failure.
Sets the list type of ‘node’, returning 1 on success and 0 on error.
Sets the string contents of ‘node’. Returns 1 on success,
0 on failure.
Sets the literal text to render “on enter” for a custom ‘node’.
Any children of the node will be rendered after this text.
Returns 1 on success 0 on failure.
Sets the literal text to render “on exit” for a custom ‘node’.
Any children of the node will be rendered before this text.
Returns 1 on success 0 on failure.
Set the string ‘content’ for all types of ‘node’.
Copies ‘content’.
Set the syntax extension responsible for creating ‘node’.
Sets the title of a link or image ‘node’. Returns 1 on success,
0 on failure.
Change the type of ‘node’.
Sets the URL of a link or image ‘node’. Returns 1 on success,
0 on failure.
Sets arbitrary user data for ‘node’. Returns 1 on success,
0 on failure.
Set free function for user data
Unlinks a ‘node’, removing it from the tree, but not freeing its
memory. (Use ‘cmark_node_free’ for that.)
Remove the last n characters from the last child of the given node.
This only works where all n characters are in the single last child, and the last
child is CMARK_NODE_TEXT.
Parse a CommonMark document in ‘buffer’ of length ‘len’.
Returns a pointer to a tree of nodes. The memory allocated for
the node tree should be released using ‘cmark_node_free’
when it is no longer needed.
Parse a CommonMark document in file ‘f’, returning a pointer to
a tree of nodes. The memory allocated for the node tree should be
released using ‘cmark_node_free’ when it is no longer needed.
Add a child to ‘parent’ during the parsing process.
Advance the ‘offset’ of the parser in the current line.
Attach the syntax ‘extension’ to the ‘parser’, to provide extra syntax
rules.
See the documentation for cmark_syntax_extension for more information.
Feeds a string of length ‘len’ to ‘parser’.
Finish parsing and return a pointer to a tree of nodes.
Frees memory allocated for a parser object.
Return the offset in ‘columns’ in the line being processed.
Return the absolute index in bytes of the first nonspace
character coming after the offset as returned by
cmark_parser_get_offset() in the line currently being processed.
Return the absolute index of the first nonspace column coming after ‘offset’
in the line currently being processed, counting tabs as multiple
columns as appropriate.
Return the difference between the values returned by
cmark_parser_get_first_nonspace_column() and
cmark_parser_get_column().
Return the length in bytes of the previously processed line, excluding potential
newline (\n) and carriage return (\r) trailing characters.
Return the index of the line currently being parsed, starting with 1.
Return the offset in bytes in the line being processed.
Return ‘true’ if the value returned by cmark_parser_get_offset()
is ‘inside’ an expanded tab.
Return ‘true’ if the line currently being processed has been entirely
consumed, ‘false’ otherwise.
Creates a new parser object.
Creates a new parser object with the given memory allocator
See the documentation for ‘cmark_syntax_extension’
Register a syntax ‘extension’ with the ‘plugin’, it will be made
available as an extension and, if attached to a cmark_parser
with ‘cmark_parser_attach_syntax_extension’, it will contribute
to the block parsing process.
Render a ‘node’ tree as a commonmark document.
It is the caller’s responsibility to free the returned buffer.
As for ‘cmark_render_commonmark’, but specifying the allocator to use for
the resulting string.
Render a ‘node’ tree as an HTML fragment. It is up to the user
to add an appropriate header and footer. It is the caller’s
responsibility to free the returned buffer.
As for ‘cmark_render_html’, but specifying the allocator to use for
the resulting string.
Render a ‘node’ tree as a LaTeX document.
It is the caller’s responsibility to free the returned buffer.
As for ‘cmark_render_latex’, but specifying the allocator to use for
the resulting string.
Render a ‘node’ tree as a groff man page, without the header.
It is the caller’s responsibility to free the returned buffer.
As for ‘cmark_render_man’, but specifying the allocator to use for
the resulting string.
Render a ‘node’ tree as a plain text document.
It is the caller’s responsibility to free the returned buffer.
As for ‘cmark_render_plaintext’, but specifying the allocator to use for
the resulting string.
Render a ‘node’ tree as XML. It is the caller’s responsibility
to free the returned buffer.
As for ‘cmark_render_xml’, but specifying the allocator to use for
the resulting string.
Free a cmark_syntax_extension.
See the documentation for ‘cmark_syntax_extension’
Return a newly-constructed cmark_syntax_extension, named ‘name’.
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
See the documentation for ‘cmark_syntax_extension’
The library version as integer for runtime checks. Also available as
macro CMARK_VERSION for compile time checks.
The library version string for runtime checks. Also available as
macro CMARK_VERSION_STRING for compile time checks.