summaryrefslogtreecommitdiff
path: root/src/node.h
AgeCommit message (Collapse)Author
2020-01-23Rearrange struct cmark_nodeNick Wellnhofer
Introduce multi-purpose data/len members in struct cmark_node. This is mainly used to store literal text for inlines, code and HTML blocks. Move the content strbuf for blocks from cmark_node to cmark_parser. When finalizing nodes that allow inlines (paragraphs and headings), detach the strbuf and store the block content in the node's data/len members. Free the block content after processing inlines. Reduces size of struct cmark_node by 8 bytes.
2020-01-23Improve packing of struct cmark_listNick Wellnhofer
Allows to reduce size of struct cmark_node later.
2020-01-23Use C string instead of chunk for literal textNick Wellnhofer
Use zero-terminated C strings and a separate length field instead of cmark_chunks. Literal inline text will now be copied from the parent block's content buffer, slowing the benchmark down by 10-15%. The node struct never references memory of other nodes now, fixing #309. Node accessors don't have to check for delayed creation of C strings, so parsing and iterating all literals using the public API should actually be faster than before.
2020-01-23Use C string instead of chunk for custom block contentsNick Wellnhofer
Reduces size of struct cmark_node by 8 bytes.
2020-01-23Use C string instead of chunk for link URL and titleNick Wellnhofer
Use zero-terminated C strings instead of cmark_chunks without storing the length. This introduces a few additional strlen computations, but overhead should be low. Allows to reduce size of struct cmark_node later.
2020-01-23Use C string instead of chunk for code info and literalNick Wellnhofer
Use zero-terminated C strings instead of cmark_chunks without storing the length. The length of code literals will be readded in a later commit. strlen overhead for code info should be negligible. Reduces size of struct cmark_node by 8 bytes.
2019-03-17Add CMARK_NODE__LAST_LINE_CHECKED flag.John MacFarlane
Use this to avoid unnecessary recursion in ends_with_blank_line. Closes #284.
2017-08-10Fix inlines spanning newlines, text in non-paraYuki Izumi
2016-06-06node: Memory dietVicent Marti
Reduce the storage size for the `cmark_code` struct
2016-06-06node: Memory dietVicent Marti
Save node information in flags instead of using one boolean for each property.
2016-06-06cmark: Implement support for custom allocatorsVicent Marti
2015-12-22Rename 'header' -> 'heading'.John MacFarlane
See jgm/CommonMark commit 0cdbcee4e840abd0ac7db93797b2b75ca4104314 Note that we have defined cmark_node_get_header_level = cmark_node_get_heading_level and cmark_node_set_header_level = camrk_node_set_heading_level for backwards compatibility in the API.
2015-12-19Changed API for CUSTOM_BLOCK and CUSTOM_INLINE.John MacFarlane
Instead of using their `as.literal` content, we now give each custom node *two* literal fields, one to be printed on entering the node (before rendering the children, if any), the other on exiting (after rendering children). This gives us the flexibility to have custom nodes with children.
2015-07-27Use clang-format, llvm style, for formatting.John MacFarlane
* Reformatted all source files. * Added 'format' target to Makefile. * Removed 'astyle' target. * Updated .editorconfig.
2015-07-10Updates for new HTML block spec.John MacFarlane
* Rewrote spec for HTML blocks. A few other spec examples also changed as a result. * Removed old `html_block_tag` scanner. Added new `html_block_start` and `html_block_start_7`, as well as `html_block_end_n` for n = 1-5. * Rewrote block parser for new HTML block spec.
2015-05-14Store link URL and title as cmark_chunkNick Wellnhofer
2015-02-18Packed cmark_node struct to fit into 128 bytes.John MacFarlane
This gives a small performance boost (0.37 to 0.36).
2015-01-20Add user data field for nodesNick Wellnhofer
2014-12-28Added end_column to cmark_node struct.John MacFarlane
API exports cmark_node_get_column. XML writer indicates start and end line and column for block-level nodes.
2014-12-28Rename cmark_node_type_string -> cmark_node_get_type_string.John MacFarlane
And export in cmark.h public header. Also, use lowercase names, not uppercase.
2014-12-28Expose cmark_node_type_string in node.h (private header).John MacFarlane
Previously was static function S_type_string.
2014-12-16Added 'literal' field to 'code' struct.John MacFarlane
In the last few commits we were using as.code.fenced and as.literal at the same time for NODE_CODE_BLOCK, which obviously led to problems.
2014-12-15Re-added cmark_ prefix to strbuf and chunk.John MacFarlane
Reverts 225d720.
2014-12-14Use chunk for fenced code info, instead of strbuf.John MacFarlane
2014-12-13Removed cmark_ prefix on chunk and strbuf.John MacFarlane
This isn't needed any more since we don't expose these in the API.
2014-11-23Added 'fenced' flag to cmark_code struct, renamed from cmark_fenced_code.John MacFarlane
Technically we could do without this, since we can check for cmark_fence_length > 0. But it makes the code clearer and doesn't really increase the size of the node struct (because the size of the union is set by the data for lists).
2014-11-23Added internal flag to distinguish setext from atx headers.John MacFarlane
2014-11-22Fix and test node_checkNick Wellnhofer
2014-11-18Start with tests for the C APINick Wellnhofer
The C API tests can be run individually via build/api_test/api_test Or together with the spec tests via cmake --build build --target test
2014-11-17Store link labels as children in tree structureNick Wellnhofer
2014-11-17Set prev, parent and last_child for inlinesNick Wellnhofer
2014-11-17Move public stuff from node.h to cmark.hNick Wellnhofer
2014-11-17Switch cmark_node_inl over to cmark_nodeNick Wellnhofer
2014-11-17Switch cmark_node_block over to cmark_nodeNick Wellnhofer
2014-11-17Start with unified nodesNick Wellnhofer