summaryrefslogtreecommitdiff
path: root/api_test/main.c
AgeCommit message (Collapse)Author
2017-06-02Fixed cmark_node_get_list_start to return 0 for bullet lists...John MacFarlane
as documented! Closes #202.
2017-01-03Revert "Change types for source map offsets (#174)"John MacFarlane
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
2016-12-30Change types for source map offsets (#174)Nick Wellnhofer
* Improve strbuf guarantees Introduce BUFSIZE_MAX macro and make sure that the strbuf implementation can handle strings up to this size. * Abort early if document size exceeds internal limit * Change types for source map offsets Switch to size_t for the public API, making the public headers C89-compatible again. Switch to bufsize_t internally, reducing memory usage and improving performance on 32-bit platforms. * Make parser return NULL on internal index overflow Make S_parser_feed set an error and ignore subsequent chunks if the total input document size exceeds an internal limit. Make cmark_parser_finish return NULL if an error was encountered. Add public API functions to retrieve error code and error message. strbuf overflow in renderers and OOM in parser or renderers still cause an abort.
2016-10-11Ran 'make format' to reformat code.John MacFarlane
2016-10-11Add test for NUL-LF sequenceYuki Izumi
2016-07-11Modified api_test for change in "two blanks break out of a list."John MacFarlane
2016-07-03Fix chunk_set_cstr with suffix of current stringNick Wellnhofer
It's possible that cmark_chunk_set_cstr is called with a substring (suffix) of the current string. Delay freeing of the chunk content to handle this case correctly. Fixes issue #139.
2016-04-09Merge pull request #111 from PavloKapyshin/masterJohn MacFarlane
Add library option to render softbreaks as spaces
2016-03-26api_test: fix leakMathieu Duponchelle
Replaced nodes are not automatically freed.
2016-03-26Added api_test for #117.John MacFarlane
2016-03-18Add library option to render softbreaks as spacesPavlo Kapyshin
2016-01-18Automatic code reformat.John MacFarlane
2016-01-17Adjusted api test for last commonmark renderer change.John MacFarlane
2016-01-10Added cmark_node_replace(oldnode, newnode).John MacFarlane
API change. I've found in using the API that this is very often wanted.
2016-01-08Fixed get_containing_block logic in src/commonmark.c.John MacFarlane
This did not allow for the possibility that a node might have no containing block, causing the commonmark renderer to segfault if passed an inline node with no block parent.
2016-01-08Added an api_test that segfaults.John MacFarlane
render_commonmark on a non-block node. Still don't know why.
2015-12-28Added xml renderer test to API tests.John MacFarlane
Closes #51.
2015-12-28api_test: updated commonmark renderer test.John MacFarlane
Removed a test we can't yet handle with the render interface. The renderer isn't smart enough to escape a `-` that wraps to the beginning of a line.
2015-12-28Added to commonmark renderer test.John MacFarlane
2015-12-28Added commonmark renderer test (currently failing).John MacFarlane
2015-12-28Added simple latex renderer test to api tests.John MacFarlane
2015-12-28Added a minimal man renderer test to api tests.John MacFarlane
2015-12-28Reformat sources.John MacFarlane
2015-12-28Rename NODE_HTML -> NODE_HTML_BLOCK, NODE_INLINE_HTML -> NODE_HTML_INLINE.John MacFarlane
API change. Sorry, but this is the time to break things, before 1.0 is released. This matches the recent changes to CommonMark.dtd.
2015-12-22Rename hrule -> thematic_break.John MacFarlane
CMARK_NODE_HRULE -> CMARK_NODE_THEMATIC_BREAK. However we've defined the former as the latter to keep backwards compatibility. See jgm/CommonMark 8fa94cb460f5e516b0e57adca33f50a669d51f6c
2015-12-22CMARK_NODE_HEADER -> CMARK_NODE_HEADING.John MacFarlane
Defined CMARK_NODE_HEADER to CMARK_NODE_HEADING to ease the transition.
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-19Added api_tests for custom nodes.John MacFarlane
2015-08-08Treat line ending with EOF as ending with newline.John MacFarlane
Closes #71. Added a test to api_test.
2015-08-07Added api_test case for #68.John MacFarlane
Currently fails.
2015-07-13Added `CMARK_OPT_SAFE` option and `--safe` command-line flag.John MacFarlane
* Added `CMARK_OPT_SAFE`. This option disables rendering of raw HTML and potentially dangerous links. * Added `--safe` option in command-line program. * Updated `cmark.3` man page. * Added `scan_dangerous_url` to scanners. * In HTML, suppress rendering of raw HTML and potentially dangerous links if `CMARK_OPT_SAFE`. Dangerous URLs are those that begin with `javascript:`, `vbscript:`, `file:`, or `data:` (except for `image/png`, `image/gif`, `image/jpeg`, or `image/webp` mime types). * Added `api_test` for `OPT_CMARK_SAFE`. * Rewrote `README.md` on security.
2015-06-25Changed version variables to functions.Andrius Bentkus
This is easier to access using ffi, since some languages, like C# like to use only function interfaces for accessing library functionality. fixes #60
2015-06-16Added `CMARK_OPT_VALIDATE_UTF8` option.John MacFarlane
Also command line option `--validate-utf8`. This option causes cmark to check for valid UTF-8, replacing invalid sequences with the replacement character, U+FFFD. Reinstated api tests for utf8.
2015-06-16Removed utf8 validation tests.John MacFarlane
We no longer validate utf8 before parsing.
2015-06-07Use size_t for strlen result in API testNick Wellnhofer
2015-06-04Added test for different line endings to api_test.John MacFarlane
2015-05-07Multiple issues with numeric entitiesNick Wellnhofer
This closes #33.
2015-03-15Added options parameter to cmark_markdown_to_html.John MacFarlane
2015-02-15Added options parameter to cmark_parse_document, cmark_parse_file.John MacFarlane
Also to some non-exported functions in blocks and inlines.
2015-01-23Improve version informationNick Wellnhofer
Add version number and string as macros and symbols. Version numbers can be easily compared, for example in the C preprocessor: #include <cmark.h> #if CMARK_VERSION < 0x020200 #error Requires libcmark 2.2.0 or higher #endif Storing the version in a global variable allows to check the library version at runtime. For example: if (CMARK_VERSION != cmark_version) { warn("Compiled against libcmark %s, but using %s", CMARK_VERSION_STRING, cmark_version_string); } The version should be updated whenever the public API is changed.
2015-01-10Rework iteratorsNick Wellnhofer
* Advance to the next node when calling 'cmark_iter_next', not when calling 'cmark_iter_get_node'. * Add 'cmark_iter_get_event_type' accessor. * Allow deletion of nodes after an 'EXIT' event, or an 'ENTER' event for leaf nodes.
2014-12-31Fix C++ API testNick Wellnhofer
2014-12-29Added options parameter to renderers.John MacFarlane
To keep the API simple and avoid API changes when new options are added, this is just a long integer. Set it by disjoining options that are defined as powers of 2: e.g. `CMARK_HTML_SOURCEPOS | CMARK_HTML_HARDREAKS`. Test options using `&`: `if (options & CMARK_HTML_SOURCEPOS)`. Added `--hardbreaks` and `--sourcepos` command-line options.
2014-12-28Added cmark_node_set_list_delim, cmark_node_get_list_delim.John MacFarlane
Even though this doesn't make a difference in default HTML output, it's worth keeping track; some output formats may allow you to distinguish lists with `1)` and with `1.` delimiters.
2014-12-28Rename CMARK_NODE_LIST_ITEM -> CMARK_NODE_ITEM.John MacFarlane
2014-12-14Rename get/set_string_content -> get/set_literal.John MacFarlane
2014-12-14Rename CMARK_NODE_INLINE_CODE -> CMARK_NODE_CODE.John MacFarlane
2014-12-13Added iterator interface to API, removed cmark_walk.John MacFarlane
* Added `iterator.c`, `iterator.h`. * Removed `cmark_walk`. * Replaced `cmark_walk` with iterator in HTML renderer. * Replaced API test for `cmark_walk` with simple iterator test.
2014-12-13API improvements: cmark_event_type parameter for walk handlers.John MacFarlane
Added cmark_event_type enum, which is used as the second parameter of the handler passed to cmark_walk. See #224.
2014-12-13Remove CMARK_NODE_REFERENCE_DEF from API.John MacFarlane
Modified finalize in blocks.c to return parent of finalized block, so we can handle the case of reference definitions, when we simply remove the finalized block.