package vendor:commonmark

⌘K
Ctrl+K
or
/

    Overview

    Bindings for CMark.

    Original authors: John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer. See LICENSE for license details.

    Example:
    import cm "vendor:commonmark"
    
    // Parsing - Simple interface
    hellope_world :: proc() {
    	fmt.printf("CMark version: %v\n", cm.version_string())
    
    	str := "Hellope *world*!"
    	root := cm.parse_document(raw_data(str), len(str), cm.DEFAULT_OPTIONS)
    	defer cm.node_free(root)
    
    	html := cm.render_html(root, cm.DEFAULT_OPTIONS)
    	defer cm.free(html)
    
    	fmt.println(html)
    }
    
    // Parsing - Streaming interface
    streaming :: proc() {
    	using cm
    
    	STR :: "Hellope *world*!\n\n"
    	N   :: 50
    	STREAM_SIZE :: 42
    
    	str_buf: [len(STR) * N]u8
    	for i in 0..<N {
    		copy(str_buf[i*len(STR):], STR)
    	}
    
    	parser := parser_new(DEFAULT_OPTIONS)
    	defer parser_free(parser)
    
    	buf := str_buf[:]
    	for len(buf) > STREAM_SIZE {
    		parser_feed(parser, raw_data(buf), STREAM_SIZE)
    		buf = buf[STREAM_SIZE:]
    	}
    
    	if len(buf) > 0 {
    		parser_feed(parser, raw_data(buf), len(buf))
    		buf = buf[len(buf):]
    	}
    
    	root := parser_finish(parser)
    	defer cm.node_free(root)
    
    	html := cm.render_html(root, cm.DEFAULT_OPTIONS)
    	defer cm.free(html)
    
    	fmt.println(html)
    }
    

    An 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.

    The iterator will first descend to a child node, if there is one. When there is no child, the iterator will go to the next sibling. When there is no next sibling, the iterator will return to the parent (but with an Event_Type.Exit).

    The iterator will return .Done when it reaches the root node again.

    One natural application is an HTML renderer, where an .Enter event outputs an open tag and an .Exit event outputs a close tag.

    An iterator might also be used to transform an AST in some systematic way, for example, turning all level-3 headings into regular paragraphs.

    usage_example(root: ^Node) {
        ev_type: Event_Type
        iter := iter_new(root)
        defer iter_free(iter)
        for {
            ev_type = iter_next(iter)
            if ev_type == .Done do break
            cur := iter_get_node(iter)
            // Do something with `cur` and `ev_type`
        }
    }
    

    Iterators will never return .Exit events for leaf nodes, which are nodes of type:

    HTML_Block Thematic_Break Code_Block Text Soft_Break Line_Break Code HTML_Inline

    Nodes must only be modified after an .Exit event, or an .Enter event for leaf nodes.

    Index

    Variables (0)

    This section is empty.

    Procedures (79)
    Procedure Groups (1)
    `#config` values (1)

    Types

    Allocator ¶

    Allocator :: struct {
    	calloc:  proc "c" (num: uint, size: uint) -> rawptr,
    	realloc: proc "c" (ptr: rawptr, new_size: uint) -> rawptr,
    	free:    proc "c" (ptr: rawptr),
    }
     

    Custom allocator - Defines the memory allocation functions to be used by CMark when parsing and allocating a document tree

    Related Procedures With Parameters

    Code ¶

    Code :: struct {
    	info:         cstring,
    	fence_length: u8,
    	fence_offset: u8,
    	fence_char:   u8,
    	fenced:       b8,
    }

    Custom ¶

    Custom :: struct {
    	on_enter: cstring,
    	on_exit:  cstring,
    }

    Delim_Type ¶

    Delim_Type :: enum i32 {
    	None, 
    	Period, 
    	Paren, 
    }

    Event_Type ¶

    Event_Type :: enum i32 {
    	None, 
    	Done, 
    	Enter, 
    	Exit, 
    }

    Related Procedures With Returns

    Heading ¶

    Heading :: struct {
    	internal_offset: i32,
    	level:           i8,
    	setext:          bool,
    }

    Iter ¶

    Iter :: distinct rawptr

    Related Procedures With Parameters

    Link :: struct {
    	url:   cstring,
    	title: cstring,
    }

    List ¶

    List :: struct {
    	marker_offset: i32,
    	padding:       i32,
    	start:         i32,
    	list_type:     u8,
    	delimiter:     u8,
    	bullet_char:   u8,
    	tight:         bool,
    }

    List_Type ¶

    List_Type :: enum i32 {
    	None, 
    	Bullet, 
    	Ordered, 
    }

    Node ¶

    Node :: struct {
    	mem:          ^Allocator,
    	next:         ^Node,
    	prev:         ^Node,
    	parent:       ^Node,
    	first_child:  ^Node,
    	last_child:   ^Node,
    	user_data:    rawptr,
    	data:         [^]u8,
    	len:          bufsize_t,
    	start_line:   i32,
    	start_column: i32,
    	end_line:     i32,
    	end_column:   i32,
    	type:         Node_Type,
    	flags:        bit_set[Node_Flag; u16],
    	as:           struct #raw_union {
    		list:            List `raw_union_tag:"type=.List"`,
    		code:            Code `raw_union_tag:"type=.Code"`,
    		heading:         Heading `raw_union_tag:"type=.Heading"`,
    		link:            Link `raw_union_tag:"type=.Link"`,
    		custom:          Custom `raw_union_tag:"type=.Custom"`,
    		html_block_type: i32 `raw_union_tag:"type=.HTML_Block"`,
    	},
    }
     

    Node creation, destruction, and tree traversal

    Related Procedures With Parameters

    Related Procedures With Returns

    Node_Flag ¶

    Node_Flag :: enum u16 {
    	Open                 = 0, 
    	Last_Line_Blank      = 1, 
    	Last_Line_Checked    = 2, 
    	List_Last_Line_Blank = 3, 
    }

    Node_Type ¶

    Node_Type :: enum u16 {
    	// Error status
    	None           = 0, 
    	// Block 
    	Document, 
    	Block_Quote, 
    	List, 
    	Item, 
    	Code_Block, 
    	HTML_Block, 
    	Custom_Block, 
    	Paragraph, 
    	Heading, 
    	Thematic_Break, 
    	// Inline 
    	Text, 
    	Soft_Break, 
    	Line_Break, 
    	Code, 
    	HTML_Inline, 
    	Custom_Inline, 
    	Emph, 
    	Strong, 
    	Link, 
    	Image, 
    	First_Block    = Document, 
    	Last_Block     = Thematic_Break, 
    	First_Inline   = Text, 
    	Last_Inline    = Image, 
    }

    Related Procedures With Parameters

    Option ¶

    Option :: enum i32 {
    	Source_Position = 1,  // Include a `data-sourcepos` attribute on all block elements.
    	Hard_Breaks     = 2,  // Render `softbreak` as hard line breaks.
    	Safe            = 3,  // Defined for API compatibility, now enabled by default.
    	Unsafe          = 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.
    	No_Breaks       = 4,  // Render `softbreak` elements as spaces.
    	Normalize       = 8,  // Legacy option, no effect.
    	Validate_UTF8   = 9,  // Validate UTF-8 input before parsing, replacing illegal
    	// sequences with the replacement character U+FFFD.
    	Smart           = 10, // Convert straight quotes to curly, --- to em dashes, -- to en dashes.
    }

    Version_Info ¶

    Version_Info :: struct {
    	patch: u8,
    	minor: u8,
    	major: u8,
    	_:     u8,
    }
     

    Version information

    Related Constants

    Constants

    BINDING_VERSION ¶

    BINDING_VERSION :: Version_Info{major = 0, minor = 31, patch = 2}

    COMMONMARK_SHARED ¶

    COMMONMARK_SHARED :: #config(COMMONMARK_SHARED, false)
    -define:COMMONMARK_SHARED=false

    DEFAULT_OPTIONS ¶

    DEFAULT_OPTIONS: bit_set[Option; i32] : Options{}

    Variables

    This section is empty.

    Procedures

    consolidate_text_nodes ¶
    C · cmark_consolidate_text_nodesSource · cmark.odin:422

    consolidate_text_nodes :: proc "c" (root: ^Node) ---
     

    Consolidates adjacent text nodes.

    free_cstring ¶

    free_cstring :: proc "c" (str: cstring) {…}

    free_rawptr ¶

    free_rawptr :: proc "c" (ptr: rawptr) {…}
     

    Helpers to free results from render_*.

    free_string ¶

    free_string :: proc "c" (s: string) {…}

    get_default_mem_allocator ¶
    C · cmark_get_default_mem_allocatorSource · cmark.odin:129

    get_default_mem_allocator :: proc "c" () -> (mem: ^Allocator) ---
     

    Returns a pointer to the default memory allocator.

    get_default_mem_allocator_as_odin ¶

    get_default_mem_allocator_as_odin :: proc() -> runtime.Allocator {…}

    iter_free ¶
    C · cmark_iter_freeSource · cmark.odin:270

    iter_free :: proc "c" (iter: ^Iter) ---
     

    Frees the memory allocated for an iterator.

    iter_get_event_type ¶
    C · cmark_iter_get_event_typeSource · cmark.odin:279

    iter_get_event_type :: proc "c" (iter: ^Iter) -> (event_type: Event_Type) ---
     

    Returns the current event type.

    iter_get_node ¶
    C · cmark_iter_get_nodeSource · cmark.odin:276

    iter_get_node :: proc "c" (iter: ^Iter) -> (node: ^Node) ---
     

    Returns the current node.

    iter_get_root ¶
    C · cmark_iter_get_rootSource · cmark.odin:282

    iter_get_root :: proc "c" (iter: ^Iter) -> (root: ^Node) ---
     

    Returns the root node.

    iter_new ¶
    C · cmark_iter_newSource · cmark.odin:267

    iter_new :: proc "c" (root: ^Node) -> (iter: ^Iter) ---
     

    Creates a new iterator starting at 'root'. The current node and event type are undefined until iter_next is called for the first time. The memory allocated for the iterator should be released using 'iter_free' when it is no longer needed.

    iter_next ¶
    C · cmark_iter_nextSource · cmark.odin:273

    iter_next :: proc "c" (iter: ^Iter) -> (event_type: Event_Type) ---
     

    Advances to the next node and returns the event type (.Enter, .Exit, .Done)

    iter_reset ¶
    C · cmark_iter_resetSource · cmark.odin:287

    iter_reset :: proc "c" (iter: ^Iter, current: ^Node, event_type: Event_Type) ---
     

    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.

    markdown_to_html ¶
    C · cmark_markdown_to_htmlSource · cmark.odin:111

    markdown_to_html :: proc "c" (
    	text:    cstring, 
    	length:  uint, 
    	options: bit_set[Option; i32], 
    ) -> (html: cstring) ---
     

    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.

    markdown_to_html_from_string ¶

    markdown_to_html_from_string :: proc(
    	text:    string, 
    	options: bit_set[Option; i32], 
    ) -> (html: string) {…}

    node_append_child ¶
    C · cmark_node_append_childSource · cmark.odin:419

    node_append_child :: proc "c" (node: ^Node, child: ^Node) -> (success: b32) ---
     

    Adds 'child' to the end of the children of node. Returns true on success, false on failure.

    node_first_child ¶
    C · cmark_node_first_childSource · cmark.odin:245

    node_first_child :: proc "c" (node: ^Node) -> (child: ^Node) ---
     

    Returns the first child of node, or nil if node has no children.

    node_free ¶
    C · cmark_node_freeSource · cmark.odin:230

    node_free :: proc "c" (node: ^Node) ---
     

    Frees the memory allocated for a node and any children.

    node_get_end_column ¶
    C · cmark_node_get_end_columnSource · cmark.odin:392

    node_get_end_column :: proc "c" (node: ^Node) -> (column: i32) ---
     

    Returns the column at which node ends.

    node_get_end_line ¶
    C · cmark_node_get_end_lineSource · cmark.odin:389

    node_get_end_line :: proc "c" (node: ^Node) -> (line: i32) ---
     

    Returns the line on which node ends.

    node_get_fence_info ¶
    C · cmark_node_get_fence_infoSource · cmark.odin:344

    node_get_fence_info :: proc "c" (node: ^Node) -> (fence_info: cstring) ---
     

    Returns the info string from a fenced code block.

    node_get_heading_level ¶
    C · cmark_node_get_heading_levelSource · cmark.odin:313

    node_get_heading_level :: proc "c" (node: ^Node) -> (level: i32) ---
     

    Returns the heading level of node, or 0 if node is not a heading.

    node_get_list_delim ¶
    C · cmark_node_get_list_delimSource · cmark.odin:325

    node_get_list_delim :: proc "c" (node: ^Node) -> (delim_type: Delim_Type) ---
     

    Returns the list delimiter type of node, or .No_Delim if not a list.

    node_get_list_start ¶
    C · cmark_node_get_list_startSource · cmark.odin:331

    node_get_list_start :: proc "c" (node: ^Node) -> (start: i32) ---
     

    Returns starting number of node, if it is an ordered list, otherwise 0.

    node_get_list_tight ¶
    C · cmark_node_get_list_tightSource · cmark.odin:338

    node_get_list_tight :: proc "c" (node: ^Node) -> (tight: b32) ---
     

    Returns true if node is a tight list, false otherwise.

    node_get_list_type ¶
    C · cmark_node_get_list_typeSource · cmark.odin:319

    node_get_list_type :: proc "c" (node: ^Node) -> (list_type: List_Type) ---
     

    Returns the list type of node, or .No_List if not a list.

    node_get_literal ¶
    C · cmark_node_get_literalSource · cmark.odin:307

    node_get_literal :: proc "c" (node: ^Node) -> (content: cstring) ---
     

    Returns the string contents of node, or an empty string if none is set. Returns nil if called on a node that does not have string content.

    node_get_on_enter ¶
    C · cmark_node_get_on_enterSource · cmark.odin:365

    node_get_on_enter :: proc "c" (node: ^Node) -> (on_enter: cstring) ---
     

    Returns the literal "on enter" text for a custom node, or an empty string if no on_enter is set. Returns nil if called on a non-custom node.

    node_get_on_exit ¶
    C · cmark_node_get_on_exitSource · cmark.odin:375

    node_get_on_exit :: proc "c" (node: ^Node) -> (on_exit: cstring) ---
     

    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.

    node_get_start_column ¶
    C · cmark_node_get_start_columnSource · cmark.odin:386

    node_get_start_column :: proc "c" (node: ^Node) -> (column: i32) ---
     

    Returns the column at which node begins.

    node_get_start_line ¶
    C · cmark_node_get_start_lineSource · cmark.odin:383

    node_get_start_line :: proc "c" (node: ^Node) -> (line: i32) ---
     

    Returns the line on which node begins.

    node_get_title ¶
    C · cmark_node_get_titleSource · cmark.odin:358

    node_get_title :: proc "c" (node: ^Node) -> (title: cstring) ---
     

    Returns the title of a link or image node, or an empty string if no title is set. Returns nil if called on a node that is not a link or image.

    node_get_type ¶
    C · cmark_node_get_typeSource · cmark.odin:300

    node_get_type :: proc "c" (node: ^Node) -> (node_type: Node_Type) ---
     

    Returns the type of node, or .None on error.

    node_get_type_string ¶
    C · cmark_node_get_type_stringSource · cmark.odin:303

    node_get_type_string :: proc "c" (node: ^Node) -> (node_type: cstring) ---
     

    Like node_get_type, but returns a string representation of the type, or "<unknown>".

    node_get_url ¶
    C · cmark_node_get_urlSource · cmark.odin:351

    node_get_url :: proc "c" (node: ^Node) -> (url: cstring) ---
     

    Returns the URL of a link or image node, or an empty string if no URL is set. Returns nil if called on a node that is not a link or image.

    node_get_user_data ¶
    C · cmark_node_get_user_dataSource · cmark.odin:294

    node_get_user_data :: proc "c" (node: ^Node) -> (user_data: rawptr) ---
     

    Returns the user data of node.

    node_insert_after ¶
    C · cmark_node_insert_afterSource · cmark.odin:406

    node_insert_after :: proc "c" (node: ^Node, sibling: ^Node) -> (success: b32) ---
     

    Inserts 'sibling' after node. Returns true on success, false on failure.

    node_insert_before ¶
    C · cmark_node_insert_beforeSource · cmark.odin:403

    node_insert_before :: proc "c" (node: ^Node, sibling: ^Node) -> (success: b32) ---
     

    Inserts 'sibling' before node. Returns true on success, false on failure.

    node_is_block ¶
    C · cmark_node_is_blockSource · cmark.odin:212

    node_is_block :: proc "c" (node: ^Node) -> (is_block: bool) ---
     

    Returns true if node is a block node.

    node_is_inline ¶
    C · cmark_node_is_inlineSource · cmark.odin:215

    node_is_inline :: proc "c" (node: ^Node) -> (is_inline: bool) ---
     

    Returns true if node is an inline node.

    node_is_leaf ¶
    C · cmark_node_is_leafSource · cmark.odin:218

    node_is_leaf :: proc "c" (node: ^Node) -> (is_leaf: bool) ---
     

    Returns true if node is a leaf node, i.e. one that cannot contain children.

    node_last_child ¶
    C · cmark_node_last_childSource · cmark.odin:248

    node_last_child :: proc "c" (node: ^Node) -> (child: ^Node) ---
     

    Returns the last child of node, or nil if node has no children.

    node_new ¶
    C · cmark_node_newSource · cmark.odin:223

    node_new :: proc "c" (type: Node_Type) -> (node: ^Node) ---
     

    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.

    node_new_with_mem ¶
    C · cmark_node_new_with_memSource · cmark.odin:227

    node_new_with_mem :: proc "c" (type: Node_Type, mem: ^Allocator) -> (node: ^Node) ---
     

    Same as 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.

    node_next ¶
    C · cmark_node_nextSource · cmark.odin:236

    node_next :: proc "c" (node: ^Node) -> (next: ^Node) ---
     
    	Tree Traversal
    
    

    Returns the next node in the sequence after node, or nil if there is none.

    node_parent ¶
    C · cmark_node_parentSource · cmark.odin:242

    node_parent :: proc "c" (node: ^Node) -> (parent: ^Node) ---
     

    Returns the parent of node, or nil if there is none.

    node_prepend_child ¶
    C · cmark_node_prepend_childSource · cmark.odin:415

    node_prepend_child :: proc "c" (node: ^Node, child: ^Node) -> (success: b32) ---
     

    Adds 'child' to the beginning of the children of node. Returns true on success, false on failure.

    node_previous ¶
    C · cmark_node_previousSource · cmark.odin:239

    node_previous :: proc "c" (node: ^Node) -> (prev: ^Node) ---
     

    Returns the previous node in the sequence after node, or nil if there is none.

    node_replace ¶
    C · cmark_node_replaceSource · cmark.odin:411

    node_replace :: proc "c" (old_node: ^Node, new_node: ^Node) -> (success: b32) ---
     

    Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does not free its memory). Returns true on success, false on failure.

    node_set_fence_info ¶
    C · cmark_node_set_fence_infoSource · cmark.odin:347

    node_set_fence_info :: proc "c" (node: ^Node, fence_info: cstring) -> (success: b32) ---
     

    Sets the info string in a fenced code block, returning true on success and false on failure.

    node_set_heading_level ¶
    C · cmark_node_set_heading_levelSource · cmark.odin:316

    node_set_heading_level :: proc "c" (node: ^Node, level: i32) -> (success: b32) ---
     

    Sets the heading level of node. Returns true on success, false on failure.

    node_set_list_delim ¶
    C · cmark_node_set_list_delimSource · cmark.odin:328

    node_set_list_delim :: proc "c" (node: ^Node, delim_type: Delim_Type) -> (success: b32) ---
     

    Sets the delimiter type of node. Returns true on success, false on failure.

    node_set_list_start ¶
    C · cmark_node_set_list_startSource · cmark.odin:335

    node_set_list_start :: proc "c" (node: ^Node, start: i32) -> (success: b32) ---
     

    Sets starting number of node, if it is an ordered list. Returns true on success, false on failure.

    node_set_list_tight ¶
    C · cmark_node_set_list_tightSource · cmark.odin:341

    node_set_list_tight :: proc "c" (node: ^Node, tight: b32) -> (success: b32) ---
     

    Sets the "tightness" of a list. Returns true on success, false on failure.

    node_set_list_type ¶
    C · cmark_node_set_list_typeSource · cmark.odin:322

    node_set_list_type :: proc "c" (node: ^Node, list_type: List_Type) -> (success: b32) ---
     

    Sets the list type of node. Returns true on success, false on failure.

    node_set_literal ¶
    C · cmark_node_set_literalSource · cmark.odin:310

    node_set_literal :: proc "c" (node: ^Node, content: cstring) -> (success: b32) ---
     

    Sets the string contents of node. Returns true on success, false on failure.

    node_set_on_enter ¶
    C · cmark_node_set_on_enterSource · cmark.odin:370

    node_set_on_enter :: proc "c" (node: ^Node, on_enter: cstring) -> (success: b32) ---
     

    Sets the literal text to render "on enter" for a custom node. Any children of the node will be rendered after this text. Returns true on success, falseon failure.

    node_set_on_exit ¶
    C · cmark_node_set_on_exitSource · cmark.odin:380

    node_set_on_exit :: proc "c" (node: ^Node, on_exit: cstring) -> (success: b32) ---
     

    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.

    node_set_title ¶
    C · cmark_node_set_titleSource · cmark.odin:361

    node_set_title :: proc "c" (node: ^Node, title: cstring) -> (success: b32) ---
     

    Sets the title of a link or image node. Returns true on success, false on failure.

    node_set_url ¶
    C · cmark_node_set_urlSource · cmark.odin:354

    node_set_url :: proc "c" (node: ^Node, url: cstring) -> (success: b32) ---
     

    Sets the URL of a link or image node. Returns true on success, false on failure.

    node_set_user_data ¶
    C · cmark_node_set_user_dataSource · cmark.odin:297

    node_set_user_data :: proc "c" (node: ^Node, user_data: rawptr) -> (success: b32) ---
     

    Sets arbitrary user data for node. Returns true on success, false on failure.

    node_unlink :: proc "c" (node: ^Node) ---
     

    Unlinks a node, removing it from the tree, but not freeing its memory. (Use node_free for that.)

    parse_document ¶
    C · cmark_parse_documentSource · cmark.odin:452

    parse_document :: proc "c" (
    	buffer:  [^]u8, 
    	len:     uint, 
    	options: bit_set[Option; i32], 
    ) -> (root: ^Node) ---
     

    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 'node_free' when it is no longer needed.

    parse_document_from_string ¶

    parse_document_from_string :: proc "c" (
    	s:       string, 
    	options: bit_set[Option; i32], 
    ) -> (root: ^Node) {…}

    parse_from_libc_file ¶

    @(link_name="cmark_parse_file")
    parse_from_libc_file :: proc "c" (
    	file:    ^c.FILE, 
    	options: bit_set[Option; i32], 
    ) -> (root: ^Node) ---

    parser_feed ¶
    C · cmark_parser_feedSource · cmark.odin:444

    parser_feed :: proc "c" (parser: ^Parser, buffer: [^]u8, len: uint) ---
     

    Feeds a string of length 'len' to 'parser'.

    parser_feed_from_string ¶

    parser_feed_from_string :: proc "c" (parser: ^Parser, s: string) {…}

    parser_finish ¶
    C · cmark_parser_finishSource · cmark.odin:447

    parser_finish :: proc "c" (parser: ^Parser) -> (root: ^Node) ---
     

    Finish parsing and return a pointer to a tree of nodes.

    parser_free ¶
    C · cmark_parser_freeSource · cmark.odin:441

    parser_free :: proc "c" (parser: ^Parser) ---
     

    Frees memory allocated for a parser object.

    parser_new ¶
    C · cmark_parser_newSource · cmark.odin:430

    parser_new :: proc "c" (options: bit_set[Option; i32]) -> (parser: ^Parser) ---
     

    Creates a new parser object.

    parser_new_with_mem ¶
    C · cmark_parser_new_with_memSource · cmark.odin:433

    parser_new_with_mem :: proc "c" (
    	options: bit_set[Option; i32], 
    	mem:     ^Allocator, 
    ) -> (parser: ^Parser) ---
     

    Creates a new parser object with the given memory allocator.

    parser_new_with_mem_into_root ¶
    C · cmark_parser_new_with_mem_into_rootSource · cmark.odin:438

    parser_new_with_mem_into_root :: proc "c" (
    	options: bit_set[Option; i32], 
    	mem:     ^Allocator, 
    	root:    ^Node, 
    ) -> (parser: ^Parser) ---
     

    Creates a new parser object that uses root as the root node of the parsed tree. Parsed children are appended after any children root already has, which allows building one document out of several parsed fragments.

    render_commonmark ¶
    C · cmark_render_commonmarkSource · cmark.odin:489

    render_commonmark :: proc "c" (
    	root:    ^Node, 
    	options: bit_set[Option; i32], 
    	width:   i32, 
    ) -> (commonmark: cstring) ---
     

    Render a node tree as a commonmark document. It is the caller's responsibility to free the returned buffer.

    render_html ¶
    C · cmark_render_htmlSource · cmark.odin:481

    render_html :: proc "c" (root: ^Node, options: bit_set[Option; i32]) -> (html: cstring) ---
     

    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.

    render_latex ¶
    C · cmark_render_latexSource · cmark.odin:493

    render_latex :: proc "c" (
    	root:    ^Node, 
    	options: bit_set[Option; i32], 
    	width:   i32, 
    ) -> (latex: cstring) ---
     

    Render a node tree as a LaTeX document. It is the caller's responsibility to free the returned buffer.

    render_man ¶
    C · cmark_render_manSource · cmark.odin:485

    render_man :: proc "c" (
    	root:    ^Node, 
    	options: bit_set[Option; i32], 
    	width:   i32, 
    ) -> (groff: cstring) ---
     

    Render a node tree as a groff man page, without the header. It is the caller's responsibility to free the returned buffer.

    render_xml ¶
    C · cmark_render_xmlSource · cmark.odin:476

    render_xml :: proc "c" (root: ^Node, options: bit_set[Option; i32]) -> (xml: cstring) ---
     

    Render a node tree as XML. It is the caller's responsibilityto free the returned buffer.

    version ¶
    C · cmark_versionSource · cmark.odin:101

    version :: proc "c" () -> (res: Version_Info) ---

    version_string ¶
    C · cmark_version_stringSource · cmark.odin:102

    version_string :: proc "c" () -> (res: cstring) ---

    Procedure Groups

    `#config` values

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-31 23:54:16.590839100 +0000 UTC