Commit Graph

683 Commits

Author SHA1 Message Date
Martin Mitas
c4e6ddc39a md2html/render_html.h: Add extern "C" when included in C++.
Seems some people desire to use the HTML renderer in C++ projects, so
lets make this as the 1st step in making it easy :-)
2019-05-20 21:27:20 +02:00
Martin Mitas
346874e0b3 Add and fill MD_BLOCK_CODE_DETAIL::fence_char accordingly.
For the case of indented code block, it is left zeroed.

Fixes #81
2019-05-20 21:03:47 +02:00
Martin Mitas
97dd1ba8f7 Fix gcc warning at -Wpedantic.
md4c.c:184:14: warning: ISO C forbids forward references to
enumâ types [-Wpedantic]

Fixes #79
2019-05-20 14:18:14 +02:00
Martin Mitas
4d926435b9 md_analyze_line: Disallow the strcspn() optiomization path...
for other platforms then Linux. glibc has well-optimized implementation
which provides good boost, but (as measured one Windows), it can be also
relatively small to our own path below.

We can always enable that path for more platforms, if we get some data
showing it has good impact.
2019-05-19 22:40:08 +02:00
Martin Mitas
0344a077dd md_analyze_line: Fix the fast path if the input contains zero character. 2019-05-19 22:10:17 +02:00
Martin Mitas
56f8bbb19b Implement/improve some optimizations, both in the parser and HTML renderer. 2019-05-19 21:53:58 +02:00
Martin Mitas
f281db0be6 CHNANGELOG.md: Minor typo and wording fixes. 2019-05-19 11:52:04 +02:00
Martin Mitas
5138616445 md_link_label_cmp: Fix handling non-trivial folding info.
Fixes #78.
2019-05-19 11:46:26 +02:00
Martin Mitas
4f6a9e546f Update Unicode support to 12.1.
* scipts/build_*_map.py: Implement helper pythonic scripts used to
   generate some Unicode search maps and data for helper Unicode
   functions used in MD4C.

   This should simplify updating to future Unicode versions.

 * md_get_unicode_fold_info: Use data generated by the scripts.

 * md_is_unicode_whitespace__: Ditto.

 * md_is_unicode_punct__: Ditto.
2019-05-19 11:00:40 +02:00
Martin Mitas
267e82dfdc md_is_[hex|dec]_entity_contents: Fix maximal entity length.
Spec. version 0.29 limits the decimal character length to at most
7 decimal digits and hexadecimal character length to at most 6
hexadecimal digits.

Fixes #77.
2019-05-16 23:04:43 +02:00
Martin Mitas
aca5c27f1f test/spec.txt: Update from upstream head. 2019-05-16 22:48:08 +02:00
Martin Mitas
64a1bc37f5 test/coverage.txt: Sort the regression test cases by the issue number. 2019-05-15 23:25:05 +02:00
Martin Mitas
ef64fd3898 render_html.c: Improve RENDER_LITERAL to not cause warnings in MSVC 2017. 2019-05-13 10:46:50 +02:00
Martin Mitas
04c65c4c64 Build: Improve CMakeLists.txt compatibility with MSVC 2017. 2019-05-13 10:45:38 +02:00
Martin Mitas
e091d16041 Fix previous incomplete commit. 2019-05-11 00:40:28 +02:00
Martin Mitas
51da223bf3 Minor cleanup.
* md_analyze_line: Use while() loop instead of bunch of gotos.

 * Remove some manual optimizations. The optimizing skills of
   compilers have improved in the recent years. With gcc 8.3
   at -O3 there is no measurable change.
2019-05-11 00:11:44 +02:00
Martin Mitas
d7a8ede0d4 Bump version to 0.3.3. 2019-05-10 10:36:45 +02:00
Martin Mitas
74636f3ba6 md_scan_for_html_closer: Fix typo in a comment. 2019-05-08 11:07:15 +02:00
Martin Mitas
919a0cc9e0 test/*.txt: Fix some formatting. 2019-05-08 07:38:33 +02:00
Martin Mitas
1757ff55c6 test/spec_tests.py: Make ready for spec.txt from cmark-gfm project.
This allows easier checking of our GFM dialect compatibility.
2019-05-07 23:10:46 +02:00
Martin Mitas
e43f73a3e6 CHANGELOG.md: Supplement description of the issue #76. 2019-05-07 22:36:29 +02:00
Martin Mitas
83047d3eb1 md_analyze_permissive_url_autolink: Improve.
* Fix domain recognition so that it has to have at least two
   dot-delimited components.

 * Fix handling if parenthesis so that they have to form balanced
   pairs; i.e. the first ')' not having a preceding opener ends the
   path.

Fixes #76.
2019-05-07 22:24:29 +02:00
Martin Mitas
f8ed51c9f7 md_analyze_line: Simplify.
Move some common code from multiple branches to one (and more
appropriate) place.
2019-05-05 16:11:21 +02:00
Martin Mitas
609dfb0b1e md_analyze_line: Treat blank lines inside a HTML block more carefully...
... with respect to the parent list containers.

Fixes #10 (but now really).
2019-05-05 15:56:51 +02:00
Andrew Lindesay
5cf2000a4d Build: Fix a few sign-comparison issues
This will fix a couple of issues where the GCC compiler (in strict
mode) is complaining with "error: comparison between signed and
unsigned integer expressions [-Werror=sign-compare]".
2019-05-05 11:38:37 +02:00
Martin Mitas
952791318f When undoing complete block from ctx->block_bytesp[], reset ctx->current_block properly.
Fixes #74.
2019-04-30 00:32:36 +02:00
Martin Mitas
19504cad95 Revert "Build: With gcc and clang, enforce -std=c90."
This reverts commit 716b6ca444.

Rationale: snprintf() not available in C90, so -std=c90 causes
warnings on Linux.
2019-04-29 22:24:23 +02:00
Martin Mitas
d4d1091511 Improve parsing of inline raw HTML.
* Isolate some common code for scanning HTML closer into a new function
   so most HTML scanner functions reuse the same code.

 * Improve the scanning for the closer so that on failure we remember
   the range where no closer is present. So any later scanning attempts
   may fail early.

   Fixes #73.
2019-04-29 19:03:16 +02:00
Martin Mitas
716b6ca444 Build: With gcc and clang, enforce -std=c90.
See #71.

This forces us to be more conservative in the future code changes,
and make us more friendly mainly to some embedded compilers who are
often behind the current state of art.

Fix also related warnings and errors, as provided by gcc 8.1.0.
2019-04-17 15:04:17 +02:00
Shawn Rutledge
d9a5a6f68d Fix errors and warnings on INTEGRITY compiler
It seems to be applying C90 (?) rules: initializers must be
compile-time constants.

Fixes #71.
2019-04-17 14:55:53 +02:00
Martin Mitas
7a6bf33c2e Bump version to 0.3.2 2019-04-08 19:56:23 +02:00
Martin Mitas
29dfdd9120 README.md and CHANGELOG.md: Update for spec 0.29. 2019-04-08 19:45:50 +02:00
Martin Mitáš
d7920b9c25
Merge pull request #67 from mity/spec-0.29
This merges all changes for CommonMark specification 0.28 -> 0.29 transition.
2019-04-08 19:35:06 +02:00
Martin Mitas
98850288e0 md_is_html_block_start_condition: Do not recognize <meta>.
This change is mandated by specifiction 0.29.
2019-04-08 19:31:57 +02:00
Martin Mitas
734a7c8221 Allow link ref. defs. at the beginning of SeText headers. 2019-04-08 11:00:39 +02:00
Martin Mitas
5b78f295c6 test/spec.txt: Update from upstream head. 2019-04-08 11:00:27 +02:00
Martin Mitas
b7d3c1a37e Fix handling EOLs inside a code span. 2019-04-05 10:01:36 +02:00
Martin Mitas
8994c38288 md_is_code_span: Follow new spec rules for space trimming. 2019-04-05 08:19:01 +02:00
Martin Mitas
2a7b97ed46 test/spec.txt: Update from upstream head. 2019-04-05 08:18:54 +02:00
Martin Mitas
b858698784 md_collect_mark: Add missing 'continue' to '~' branch.
Fixes #69.
2019-04-03 08:28:27 +02:00
Martin Mitas
30bf566754 md_is_link_destination: Use first char as an indicator...
... type of link destination we should try.

If it is '<', then try only <>-styled link destination.
2019-03-27 02:04:49 +02:00
Martin Mitas
855a1bfccf test/spec.txt: Update from upstream head. 2019-03-27 02:04:24 +02:00
Martin Mitas
cccfb3d782 md_is_html_block_start_condition: Fix starting condition 1 when EOF follows.
Fixes #68
2019-03-26 17:04:14 +02:00
Martin Mitas
13672154bd md_is_container_mark: Check the indentation is not too big...
If it is then it is rather an indented code block.
2019-03-26 15:11:14 +02:00
Martin Mitas
94c86fe292 Revert "Fix problematic link destinations with angle brackets."
The updated specification now explicitly requests the behavior we
implemented before fixing #24.

This reverts commit 2e0a74ba99.
Also remove associated regression test as it is no longer valid.
2019-03-26 14:45:23 +02:00
Martin Mitas
0959975a8c md_analyze_emph: Follow specs changes to the "rule of three". 2019-03-26 14:01:02 +02:00
Martin Mitas
003a551d0a Remove left-over commented out code. 2019-03-26 13:51:03 +02:00
Martin Mitas
6e49193e2a md_is_link_title: Link title must be delimited from link destination with a whitespace. 2019-03-26 13:44:55 +02:00
Martin Mitas
98968e22ed Update spec.txt from upstream head.
(I previously used an updated revision of it by mistake.)
2019-03-26 13:33:05 +02:00
Martin Mitas
8f04d1135c md_is_link_destination_A: Link destination in <> can contain spaces. 2019-03-26 13:06:21 +02:00