summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-04-03Removed abort outside of conditional (typo).John MacFarlane
2017-04-03Removed coercion in error message when aborting from buffer.John MacFarlane
2017-04-03Print message to stderr when we abort due to memory demands.John MacFarlane
Closes #188. @nwellnhof - could you have a look and let me know if you think this is a bad idea or could be improved?
2017-02-05libcmark.pc: use CMAKE_INSTALL_LIBDIR (#185)Jens Petersen
needed for multilib distros like Fedora
2017-01-20Fixed buffer overflow error in S_parser_feed.John MacFarlane
The overflow could occur in the following condition: the buffer ends with `\r` and the next memory address contains `\n`. Closes #184.
2017-01-08Update emphasis parsing for spec change.John MacFarlane
Strong now goes inside Emph rather than the reverse, when both scopes are possible. The code is much simpler. This also avoids a spec inconsistency that cmark had previously: `***hi***` became Strong (Emph "hi")) but `***hi****` became Emph (Strong "hi")) "*"
2017-01-07Fixes for the LaTeX renderer (#182)Doeme
* Don't double-output the link in latex-rendering. * Prevent ligatures in dashes sensibly when rendering latex. \- is a hyphenation, so it doesn't get displayed at all. * Redo "Don't double-output the link in latex-rendering." This reverts commit 8fb1f1c3c8799628141780ca5fd8d70883c1ec53 and adds the proper solution to the problem. With commit 8fb1f1c3c double rendering is fixed, but the url isn't escaped anymore, so I discarded the wrong copy. We now return 0 from the function in case of a single link, which stops processing the contents of the node. * Add a comment about the double-rendering issue addressed in 1c0d4749451cf85a849a3cf8e41cf137789821d4
2017-01-06Merge pull request #179 from winterheart/cmakeJohn MacFarlane
CMake impovement
2017-01-06Make shared and static libraries optionalAzamat H. Hackimov
Now you can enable/disable compilation and installation targets for shared and static libraries via -DCMARK_SHARED=ON/OFF and -DCMARK_STATIC=ON/OFF
2017-01-06Added support for built-in ${LIB_SUFFIX} featureAzamat H. Hackimov
Replaced ${LIB_INSTALL_DIR} option with built-in ${LIB_SUFFIX} for installing for 32/64-bit systems. Normally, CMake will set ${LIB_SUFFIX} automatically for required enviroment. If you have any issues with it, you can override this option with -DLIB_SUFFIX=64 or -DLIB_SUFFIX="" during configuration.
2017-01-05Automatic code reformatting.John MacFarlane
2017-01-05Added a test for NULL when freeing subj->last_delim.John MacFarlane
Noticed the need for this through fuzzing.
2017-01-05Cleaned up setting of lower bounds for openers.John MacFarlane
We now use a much smaller array.
2017-01-03Fixes #178, quadratic parsing bug.John MacFarlane
2017-01-03Slight improvement of clarity of logic in emph matching.John MacFarlane
2017-01-03Revert "More sourcepos! (#169)"John MacFarlane
This reverts commit 9e643720ec903f3b448bd2589a0c02c2514805ae.
2017-01-03Revert "Change types for source map offsets (#174)"John MacFarlane
This reverts commit 4fbe344df43ed7f60a3d3a53981088334cb709fc.
2017-01-03Fix "multiple of 3" determination in emph/strong parsing.John MacFarlane
We need to store the length of the original delimiter run, instead of using the length of the remaining delimiters after some have been subtracted. Test case: a***b* c* Thanks to Raph Levin for reporting.
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-12-20More sourcepos! (#169)Mathieu Duponchelle
* open_new_blocks: always create child before advancing offset * Source map * Extent's typology * In-depth python bindings
2016-12-09Correctly initialize chunk in S_process_line (#170)Nick Wellnhofer
The `alloc` member wasn't initialized. This also allows to add an assertion in `chunk_rtrim` which doesn't work for alloced chunks.
2016-12-05scanners.c generated with re2c 0.16 (68K smaller!).John MacFarlane
2016-12-05scanners.re - fixed warnings; use * for fallback.John MacFarlane
2016-12-05Fixed some warnings in scanners.re.John MacFarlane
2016-12-03Update CaseFolding to latest (#168)Kevin Wojniak
1. Downloaded CaseFolding.txt from http://unicode.org/Public/UCD/latest/ucd/CaseFolding.txt 2. Deleted src/case_fold_switch.inc 3. Ran `make src/case_fold_switch.inc`
2016-12-01Allow balanced nested parens in link destinations (#166)Yuki Izumi
2016-11-26Allocate enough bytes for backticks array.John MacFarlane
2016-11-26Inlines: Ensure that the delimiter stack is freed in subject.John MacFarlane
2016-11-26Fixed pathological cases with backtick code spans:John MacFarlane
- Removed recursion in scan_to_closing_backticks - Added an array of pointers to potential backtick closers to subject - This array is used to avoid traversing the subject again when we've already seen all the potential backtick closers. - Added a max bound of 1000 for backtick code span delimiters. - This helps with pathological cases like: x x ` x `` x ``` x ```` ... Thanks to Martin Mitáš for identifying the problem and for discussion of solutions.
2016-11-24Remove redundant cmake_minimum_required.John MacFarlane
Closes #163, thanks to @kainjow.
2016-11-19Use VERSION_GREATER to clean up cmake version test.John MacFarlane
2016-11-19Put set_policy under cmake version test.John MacFarlane
Otherwise we get errors in older versions of cmake.
2016-11-18Set policy for CMP0063 to avoid a warning.John MacFarlane
See #162.
2016-11-13Fix warnings building with MSVC on Windows (#165)Hugh Bellamy
2016-11-09Fix CMAKE_C_VISIBILITY_PRESET for cmake versions greater than 1.8 (e.g. ↵Hugh Bellamy
3.6.2) (#162) This lets us build swift-cmark on Windows, using clang-cl This was an oversight: CMAKE_C_VISIBILITY_PRESET is only available on CMAKE 1.8 or greater. However, the current check doesn't work for a version such as CMAKE 3.6.2, for example ```bash mkdir "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64" pushd "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64" cmake -G Ninja -DCMAKE_C_COMPILER="C:/Program Files/LLVM/msbuild-bin/cl.exe" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/msbuild-bin/cl.exe" -DCMAKE_CXX_FLAGS="-Xclang -std=c++14" "C:/Users/hughb/Documents/GitHub/my-swift/cmark" popd cmake --build "C:/Users/hughb/Documents/GitHub/my-swift/build/Ninja-DebugAssert/cmark-windows-amd64/" -- -j6 all ```
2016-11-04Fix for non-matching entities (#161)Yuki Izumi
* Add test to illustrate issue * Provide some test fixes * Don't neglect CounterClockwiseContourIntegral * Fix ~10% of cases not matching strncmp returns 0 if the first 'len' bytes of cmark_entities[i].entity match s; we check equal length in the first if by checking if cmark_entities[i].entity[len] == 0, but we neglect the case where cmp == 0 && cmark_entities[i].entity[len] != 0. This should be treated as the same as cmp < 0, because strcmp("abc", "abcd") < 0. * Don't depend on py3.3 in tests
2016-10-30Modified print_delimiters (commented out) so it compiles again.John MacFarlane
2016-10-11Ran 'make format' to reformat code.John MacFarlane
2016-10-11Changed logic for null/eol checks.John MacFarlane
- only check once for "not at end of line" - check for null before we check for newline characters (the previous patch would fail for NULL + CR) See #160.
2016-10-11Fix by not advancing past both \0 and \nYuki Izumi
2016-09-27One more cmark_mem useYuki Izumi
2016-09-26Merge pull request #157 from kivikakk/list-parse-mem-leakJohn MacFarlane
Fix memory leak in list parsing
2016-09-26Fix memory leak in list parsingYuki Izumi
If `parse_list_marker` returns 1, but the second part of the `&&` clause is false, we leak `data` here.
2016-09-26Use cmark_mem to free where used to allocYuki Izumi
2016-09-15Allow a shortcut link before a (.John MacFarlane
See jgm/CommonMark#427
2016-09-14Allow tabs after setext header line.John MacFarlane
See jgm/commonmark.js#109
2016-09-13Regenerated scanners.c.John MacFarlane
2016-09-13Don't let URI schemes start with spaces.John MacFarlane
2016-09-13Merge pull request #153 from gaborcsardi/patch-1John MacFarlane
autolink scheme can contain digits
2016-09-12Fixed h2..h6 HTML blocks (jgm/CommonMark#430).John MacFarlane
Added regression test.