summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-11-11Don't allow link destinations with unbalanced unescaped parentheses.John MacFarlane
See commonmark/commonmark.js#177.
2019-07-05print_usage(): Minor grammar fix, swap two words (#305)Øyvind A. Holm
2019-04-23Link executable with static or shared libraryNick Wellnhofer
If CMARK_STATIC is on (default), link the executable with the static library. This produces exactly the same result as compiling the library sources again and linking with the object files. If CMARK_STATIC is off, link the executable with the shared library. This wasn't supported before and should be the preferred way to package cmark on Linux distros. Building only a shared library and a statically linked executable isn't supported anymore but this doesn't seem useful.
2019-04-06Resolve link references before creating setext header.John MacFarlane
A setext header line after a link reference should not create a header, according to the spec. See commonmark/commonmark-spec#395.
2019-04-06commonmark renderer: improve escaping.John MacFarlane
URL-escape special characters when escape mode is URL, and not otherwise. Entity-escape control characters (< 0x20) in non-literal escape modes.
2019-04-06render: only emit actual newline when escape mode is LITERAL.John MacFarlane
For markdown content, e.g., in other contexts we want some kind of escaping, not a literal newline.
2019-04-04Update code span normalization...John MacFarlane
to conform with spec change.
2019-04-03Allow empty `<>` link destination in reference link.John MacFarlane
2019-03-28Remove leftover includes of memory.h.John MacFarlane
Closes #290.
2019-03-26Merge pull request #269 from foonathan/masterJohn MacFarlane
Fix cmake warning about CMP0048, again
2019-03-26Fix #289.John MacFarlane
A link destination can't start with `<` unless it is an angle-bracket link that also ends with `>`. (If your URL really starts with `<`, URL-escape it.)
2019-03-23Update spec; allow internal delimiter runs to match if...John MacFarlane
both have lengths that are multiples of 3. See commonmark/commonmark#528.
2019-03-22Include references.h in parser.hJohn MacFarlane
Closes #287.
2019-03-19Update spec. Fix `[link](<foo\>)`.John MacFarlane
2019-03-19Define CMARK_OPT_SAFE for API compatibility.John MacFarlane
It doesn't do anything; this is documented.
2019-03-18Remove deprecated call to add_compiler_export_flags()Jonathan Müller
It is deprecated in CMake 3.0, the replacement is to set the CXX_VISIBILITY_PRESET (or in our case C_VISIBILITY_PRESET) and VISIBILITY_INLINES_HIDDEN properties of the target. We're already setting them by setting the CMake variables anyway, so the call can be removed.
2019-03-17Make rendering safe by default.John MacFarlane
Removes CMARK_OPT_SAFE from options. Adds CMARK_OPT_UNSAFE, with the opposite meaning. The new default behavior is to suppress raw HTML and potentially dangerous links. The CMARK_OPT_UNSAFE option has to be set explicitly to prevent this. -------------------------------------------------------- NOTE: This change will require modifications in bindings for cmark and in most libraries and programs that use cmark. -------------------------------------------------------- Closes #239, #273. Borrows heavily from @kivikakk's patch in github/cmark-gfm#123.
2019-03-17Merge pull request #254 from github/empty-inputJohn MacFarlane
Check for empty buffer when rendering
2019-03-17Avoid gcc warning for uninitialized variable.John MacFarlane
2019-03-17Use hand-rolled scanner for thematic break.John MacFarlane
Keep track of the last position where a thematic break failed to match on a line, to avoid rescanning unnecessarily. See commonmark/cmark#284.
2019-03-17Do cheaper test first.John MacFarlane
2019-03-17Rename ends_with_blank_line with S_ prefix.John MacFarlane
As with other static functions.
2019-03-17Add CMARK_NODE__LAST_LINE_CHECKED flag.John MacFarlane
Use this to avoid unnecessary recursion in ends_with_blank_line. Closes #284.
2019-03-17In ends_with_blank_line, call S_set_last_line_blank...John MacFarlane
to avoid unnecessary repetition. Once we settle whether a list item ends in a blank line, we don't need to revisit this in considering parent list items. See commonmark/cmark#284.
2019-03-17Disallow unescaped ( in parenthesized link title.John MacFarlane
In accord with spec change.
2018-11-21check for OpenBSD 5.9+Ashe Connor
2018-11-20Use pledge(2) on OpenBSDAshe Connor
2018-11-13copy line/col info straight from opener/closerAshe Connor
We can't rely on anything in `subj` since it's been modified while parsing the subject and could represent line info from a future line. This is simple and works.
2018-10-31render.c: reset last_breakable after cr.John MacFarlane
Fixes jgm/pandoc#5033.
2018-10-08Fix a typo in houdini_href_e.cFelix Yan
2018-10-04commonmark writer: use ~~~ fences if info string contains backtick.John MacFarlane
This is needed for round-trip tests.
2018-10-04Update scanners for new info string rules.John MacFarlane
2018-09-14Merge pull request #257 from pclouds/xml-space-preserveJohn MacFarlane
Add xml:space="preserve" in XML output when appropriate
2018-09-09Check for whitespace before reference title.John MacFarlane
Closes #263.
2018-09-05build: only attempt to install MSVC system libraries on WindowsSaleem Abdulrasool
Newer versions of CMake attempt to query the system for information about the VS 2017 installation. Unfortunately, this query fails on non-Windows systems when cross-compiling: cmake_host_system_information does not recognize <key> VS_15_DIR CMake will not find these system libraries on non-Windows hosts anyways, and we were silencing the warnings, so simply omit the installation when cross-compiling to Windows.
2018-08-26Simplify code normalization, in line with spec change.John MacFarlane
2018-08-25Code span spec changes.John MacFarlane
These affect both parsing and writing commonmark.
2018-07-07Add xml:space="preserve" in XML output when appropriateNguyễn Thái Ngọc Duy
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-06-11Removed meta from list of block tags.John MacFarlane
Added regression test. See commonmark/CommonMark#527.
2018-04-14Optimize S_find_first_nonspace.John MacFarlane
We were needlessly redoing things we'd already done. Now we skip the work if the first nonspace is greater than the current offset. This fixes pathological slowdown with deeply nested lists (#255). For N = 3000, the time goes from over 17s to about 0.7s. Thanks to @mity for diagnosing the problem.
2018-03-25Allow spaces in link destination delimited with pointy brackets.John MacFarlane
To conform to recent spec change.
2018-03-25Adjust max length of decimal/numeric entities.John MacFarlane
See commonmark/CommonMark#487.
2018-03-25Fix inline raw HTML parsing.John MacFarlane
This fixes a recently added failing spec test case. Previously spaces were being allowed in unquoted attribute values; no we forbid them.
2018-03-25Don't allow list markers to be indented >= 4 spaces.John MacFarlane
See commonmark/CommonMark#497.
2018-02-20Check for empty buffer when renderingPhil Turnbull
For empty documents, `->size` is zero so `renderer.buffer->ptr[renderer.buffer->size - 1]` will cause an out-of-bounds read. Empty buffers always point to the global `cmark_strbuf__initbuf` buffer so we read `cmark_strbuf__initbuf[-1]`.
2017-11-14Generate export header for static-only buildNick Wellnhofer
Fixes issue #247.
2017-11-05Merge pull request #217 from github/upstream/limit-nested-parensJohn MacFarlane
> 32 nested balanced parens in a link is bananas
2017-11-02Merge branch 'master' into upstream/inline-sourceposAshe Connor
2017-10-19Include GNUInstallDirs in src/CMakeLists.txtNick Wellnhofer
Fixes installation error under some CMake versions, notably kalakris' CMake backport often used with Travis.
2017-10-12Fixed regression in install dest for static library.John MacFarlane
Due to a mistake, 0.28.1 installed libcmark.a into include/. Closes #238.