Граф коммитов

122 Коммитов

Автор SHA1 Сообщение Дата
Kevin Backhouse 33ab1cddb8
Fix format specifier for printing a size_t 2023-07-14 11:42:25 +01:00
Kevin Backhouse 6e4493d628
Fix GHSA-66g8-4hjf-77xh: don't run expense safety check which causes quadratic performance. 2023-03-31 17:06:28 +01:00
Kevin Backhouse 0685ab0e1f
Deprecate cmark_init_standard_node_flags. 2023-01-24 23:03:45 +00:00
Kevin Backhouse 420c20a112
Add registration mechanism for custom node flags 2022-12-01 18:44:38 +00:00
Keith Packard 2a9996f671 Define _DEFAULT_SOURCE to get various posix/gnu glibc functions declared (#137)
fdopen, strdup and others are not declared by glibc header files
unless _DEFAULT_SOURCE is defined.

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-03-13 10:50:27 +11:00
Ashe Connor 7c71bd1875
Merge branch 'upstream-master' 2019-02-05 13:46:54 +11:00
Ashe Connor cfba1fc382
expand tests 2018-11-13 11:06:47 +11:00
Ashe Connor d53d533a3f
don't crash on test failure on macos 2018-11-12 16:11:27 +11:00
Ashe Connor 462cab4839
add failing test 2018-11-12 16:09:46 +11:00
Ashe Connor f64691b85d
Default to safe operation (#123)
* default to safe

* fix setter test
2018-10-17 14:42:51 +11:00
Ashe Connor e4de28e47c
Merge remote-tracking branch 'upstream/master' 2018-09-17 09:57:10 +10:00
Ashe Connor 322140091c
Normalise header and define names (#109)
* cmark -> cmark-gfm in most places

* normalize filenames, exports

* ensure some more #defines don't conflict
2018-08-21 11:58:41 +10:00
Nguyễn Thái Ngọc Duy 55afc6fd49 Add xml:space="preserve" in XML output when appropriate
With current HTML escaping, sometimes we may produce an XML tag like

    <code_block>  </code_block>

Many XML parsers consider these spaces insignificant and strip them
out but we need this. There's actually a test case like this in
spec.txt (search "A code block can have all empty lines as its
content:") and without proper hinting, an external xml->html converter
will fail the spec.

XML standard covers this case. If xml:space is "preserve", then
whitespaces are significant and should be kept. Add this hint for
text, code, code_block, html_inline and html_block tags.
2018-07-07 19:30:34 +02:00
Ashe Connor e1fa45742c
Merge remote-tracking branch 'upstream/master' 2018-01-08 09:02:30 +11:00
Ashe Connor 0c6d1c4baa
ASCII clean source 2017-12-12 11:32:36 +11:00
Nick Wellnhofer 772c4cbde5 Also run API tests with CMARK_SHARED=OFF 2017-11-18 16:16:01 +01:00
Ashe Connor 1781c95068 feature test macros in harness 2017-11-06 11:09:06 +11:00
Ashe Connor fff5fefb14
Merge branch 'upstream-master' 2017-11-06 10:59:49 +11:00
Ashe Connor 820372d95d Recursive chevrons are bananas (#49)
* Add some pathological regression tests

* Fix new pathological case

* Cleanup.

* Give it a second, for Travis
2017-09-06 11:12:46 +10:00
Ashe fd7d177fcf Sourcepos fixes (#54)
* Emphasis sourcepos broken when in block

* internal_offset for blocks containing inlines

* Really awkward newline handling

* Count newlines in every inline that could contain

* Document

* Skip sourcepos tracking if disabled
2017-08-10 13:52:20 +10:00
Yuki Izumi e22d1b42ce
Fix inlines spanning newlines, text in non-para 2017-08-10 13:29:40 +10:00
Yuki Izumi 919cdb2c58
Add sourcepos info for inlines 2017-08-09 15:56:21 +10:00
Ashe b9459ef110 Inline sourcepos (#53)
* Start working on sourcepos for inlines.

* Add a sourcepos test case

* Fix up some offsets

* Record end_column

* Fix a test sourcepos

Just need to work out how to correctly increment line numbers over
breaks now

* Handle multi-line paras

* Refactor

* Another fix and another failing test

* maintain separate block offset

* Correct link offset calculations

* Add image to test

* Break some more tests!

* Fix code length calculation

* Consolidate end_column in text nodes

* WIP!

* Complete test for extensions

* Improve test harness output

* Strikethrough sourcepos

* Start on table sourcepos

* Table sourcepos WIP

* Finish up table sourcepos

* Fix up emphasis offset calc

* Reference link sourcepos is the ref itself

This is fine!

* Add casts for MSVC

* Use the more portable remove(3)

* Windows :(

* Link against dynamic exts in api_test

* Include extensions DLL in PATH
2017-08-09 15:48:15 +10:00
Yuki Izumi b0707b68f6
make install also installs extensions (#32)
Also clean up CMakeLists considerably.
2017-06-30 12:04:03 +10:00
Yuki Izumi c0f16ae835
Plaintext renderer (#25)
* Add base test

* Add plaintext renderer

* Remove header marks

* Remove headers until it complains

* Scan HTML tags liberally on request

* MSVC10 fix
2017-06-30 12:04:02 +10:00
Yuki Izumi c2712a4fb5
Add -gfm suffix to artifacts 2017-06-30 12:04:01 +10:00
Yuki Izumi 166942bbf8
Handle UTF-8 BOM (#14)
* Add failing UTF-8 BOM test

* Add simple UTF-8 BOM skip

* Restrict BOM check to first line
2017-06-30 12:03:37 +10:00
Yuki Izumi c36f8484a5
Get a clean build on MSVC (#5) 2017-06-30 12:03:34 +10:00
Yuki Izumi 3e3761a26e
Strip extensions API down and separate from core 2017-06-30 12:03:34 +10:00
Mathieu Duponchelle c8960d74de
Extensions API (https://github.com/jgm/cmark/pull/123) 2017-06-30 12:03:33 +10:00
John MacFarlane 0b1886ca44 Fixed cmark_node_get_list_start to return 0 for bullet lists...
as documented!

Closes #202.
2017-06-02 16:23:25 +02:00
John MacFarlane 60b6962db0 Revert "Change types for source map offsets (#174)"
This reverts commit 4fbe344df4.
2017-01-03 22:08:38 -08:00
Nick Wellnhofer 4fbe344df4 Change types for source map offsets (#174)
* 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-12-30 18:25:16 -07:00
John MacFarlane 636d6018ea Ran 'make format' to reformat code. 2016-10-11 14:51:42 +02:00
Yuki Izumi 8f80fb3369
Add test for NUL-LF sequence 2016-10-11 01:43:26 +11:00
John MacFarlane b637b19f45 Modified api_test for change in "two blanks break out of a list." 2016-07-11 22:37:31 +01:00
Nick Wellnhofer 67f760a78f Fix chunk_set_cstr with suffix of current string
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-07-03 12:18:43 +02:00
John MacFarlane 0b6805c0c5 Merge pull request #111 from PavloKapyshin/master
Add library option to render softbreaks as spaces
2016-04-09 11:35:58 -07:00
Mathieu Duponchelle 7dfe7fff11 api_test: fix leak
Replaced nodes are not automatically freed.
2016-03-26 15:45:54 -07:00
John MacFarlane 7cb92c313c Added api_test for #117. 2016-03-26 12:47:47 -07:00
Pavlo Kapyshin ec64e9ea89 Add library option to render softbreaks as spaces 2016-03-18 10:28:22 +02:00
John MacFarlane e1d1593f51 Automatic code reformat. 2016-01-18 09:33:43 -08:00
John MacFarlane 9409e2ee7e Adjusted api test for last commonmark renderer change. 2016-01-17 13:25:08 -08:00
John MacFarlane 93843bd2fe Added cmark_node_replace(oldnode, newnode).
API change.

I've found in using the API that this is very often
wanted.
2016-01-10 23:35:33 -08:00
John MacFarlane 9305d14f39 Fixed get_containing_block logic in src/commonmark.c.
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-08 13:26:06 -08:00
John MacFarlane 56501dc4d3 Added an api_test that segfaults.
render_commonmark on a non-block node.

Still don't know why.
2016-01-08 13:17:02 -08:00
John MacFarlane 37e2c4b2bf Added xml renderer test to API tests.
Closes #51.
2015-12-28 17:19:25 -08:00
John MacFarlane 9821520418 api_test: updated commonmark renderer test.
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-28 17:10:07 -08:00
John MacFarlane aaa0048c01 Added to commonmark renderer test. 2015-12-28 16:45:03 -08:00
John MacFarlane ccc13fd3a0 Added commonmark renderer test (currently failing). 2015-12-28 16:35:54 -08:00