Skip to content

Update Swift fork of cmark with upstream cmark repository #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 458 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
458 commits
Select commit Hold shift + click to select a range
c069cb5
Better parsing of shortcut references.
jgm Jun 23, 2016
649ce73
Updated spec.txt.
jgm Jun 23, 2016
cf3ae36
Revert "Better parsing of shortcut references."
jgm Jun 23, 2016
dbfe3fa
Ported robinst's changes to link parsing.
jgm Jun 22, 2016
78c60ec
Travis: install more recent cmake on linux.
jgm Jun 23, 2016
6eca3cd
Updated spec.
jgm Jun 23, 2016
2365a55
Try to fix travis cmake.
jgm Jun 23, 2016
41b8c5b
Removed check for same mem allocator in S_can_contain.
jgm Jun 23, 2016
5503139
Updated man page cmark.3.
jgm Jun 24, 2016
c71830e
Removed positon from delimiter struct.
jgm Jun 24, 2016
c50197b
Changed `process_emphasis` to get better results in corner cases.
jgm Apr 13, 2016
0d546c2
Updated spec and pathological tests for changes in strong/emph parsing.
jgm Jun 25, 2016
ce5671a
Removed redundant check.
jgm Jun 25, 2016
2b1b00f
Reformatted.
jgm Jun 25, 2016
9fe857d
Export the targets on installation
foonathan Jun 27, 2016
cea0af4
Fix cmake warning about CMP0048
foonathan Jun 27, 2016
bf8bd83
Change export install location
foonathan Jun 27, 2016
089ef27
Updated spec.txt.
jgm Jul 3, 2016
3d6155f
Fixed ATX headers and thematic breaks to allow tabs as well as spaces.
jgm Jul 3, 2016
67f760a
Fix chunk_set_cstr with suffix of current string
nwellnhof Jul 3, 2016
7ae67bd
Merge pull request #140 from nwellnhof/set-cstr-fix
jgm Jul 3, 2016
ff9fad1
Makefile: have leakcheck stop on first error...
jgm Jul 11, 2016
d534f7e
Don't allow ordered lists to interrupt paragraphs unless...
jgm Jul 5, 2016
fb64964
Updated spec.
jgm Jul 11, 2016
e9c53bb
Removed "two blanks breaks out of a list" feature.
jgm Jul 11, 2016
b637b19
Modified api_test for change in "two blanks break out of a list."
jgm Jul 11, 2016
41b3307
Updated spec.
jgm Jul 11, 2016
005d6d0
Fix mistaken sourcepos for atx headers.
jgm Jul 11, 2016
b0def0a
link fix
tst2005 Jul 13, 2016
fb737bd
Updated spec.
jgm Jul 13, 2016
a47d333
Empty list items cannot interrupt paragraphs (spec change).
jgm Jul 13, 2016
9ae20a0
Replaced check for `\n` with `S_is_line_end_char`.
jgm Jul 13, 2016
e1f188f
Merge pull request #143 from tst2005/patch-1
jgm Jul 13, 2016
f988ab6
Fix sourcepos for blockquotes.
jgm Jul 13, 2016
03b5d60
Merge pull request #137 from foonathan/master
jgm Jul 15, 2016
ddae029
Updated spec.
jgm Jul 15, 2016
446f825
Reformatted.
jgm Jul 15, 2016
1dbcf46
Bump version to 0.26.0
jgm Jul 15, 2016
55a58d9
Updated changelog.
jgm Jul 15, 2016
85ad9c6
Use $(MAKE) in Makefile for recursive makes
Jul 16, 2016
3ebfa61
Removed size_t and ssize_t defs for WIN32.
jgm Jul 16, 2016
d170903
Merge pull request #146 from t6/t6-patch-1
jgm Jul 16, 2016
48b8118
Bump to 0.26.1.
jgm Jul 16, 2016
e91dc12
Update changelog.
jgm Jul 16, 2016
43e8f05
Fix typo
kapyshin Aug 9, 2016
a42aa04
Merge pull request #149 from PavloKapyshin/master
jgm Aug 9, 2016
abd7ad1
COPYING: Remove removed files
petere Aug 21, 2016
132d9cd
COPYING: Update file name and remove duplicate section
petere Aug 21, 2016
5c0a3df
Merge pull request #151 from petere/update-copying
jgm Aug 24, 2016
24b9713
Fix nullary function declarations in cmark.h
nwellnhof Aug 26, 2016
c9449a9
Merge pull request #152 from nwellnhof/function-prototypes
jgm Aug 29, 2016
2a42cd8
autolink scheme can contain digits
gaborcsardi Sep 11, 2016
dc2d831
Update spec
jgm Sep 12, 2016
fae6a25
Fixed h2..h6 HTML blocks (jgm/CommonMark#430).
jgm Sep 12, 2016
7363c07
Merge pull request #153 from gaborcsardi/patch-1
jgm Sep 13, 2016
0def926
Don't let URI schemes start with spaces.
jgm Sep 13, 2016
770b666
Regenerated scanners.c.
jgm Sep 13, 2016
f1f2ded
Regenerated cmark.3 man page.
jgm Sep 13, 2016
bbca5bb
Allow tabs after setext header line.
jgm Sep 14, 2016
a1f271d
Update spec.
jgm Sep 14, 2016
733c2ea
Update spec.
jgm Sep 15, 2016
53ef343
Allow a shortcut link before a (.
jgm Sep 15, 2016
f4e9ba2
Use cmark_mem to free where used to alloc
Sep 26, 2016
2bac457
Fix memory leak in list parsing
Sep 26, 2016
aa558b2
Merge pull request #156 from kivikakk/use-mem-to-free
jgm Sep 26, 2016
e1f89c6
Merge pull request #157 from kivikakk/list-parse-mem-leak
jgm Sep 26, 2016
268adf3
One more cmark_mem use
Sep 27, 2016
e89187b
Merge pull request #158 from kivikakk/one-more-mem
jgm Sep 27, 2016
8f80fb3
Add test for NUL-LF sequence
Oct 10, 2016
920cbd0
Fix by not advancing past both \0 and \n
Oct 10, 2016
1f51da2
Merge pull request #160 from kivikakk/kivikakk/fix-nul-lf-sequence
jgm Oct 11, 2016
89c8d70
Changed logic for null/eol checks.
jgm Oct 11, 2016
85d47d0
'make format': don't change order of includes.
jgm Oct 11, 2016
636d601
Ran 'make format' to reformat code.
jgm Oct 11, 2016
14fe768
Modified print_delimiters (commented out) so it compiles again.
jgm Oct 30, 2016
64e1394
Fix for non-matching entities (#161)
Nov 4, 2016
9f2c3ba
Fix CMAKE_C_VISIBILITY_PRESET for cmake versions greater than 1.8 (e.…
hughbe Nov 9, 2016
7fa73fa
Fix warnings building with MSVC on Windows (#165)
hughbe Nov 13, 2016
4c6799f
Update spec.
jgm Nov 18, 2016
c268005
Update man 3 page.
jgm Nov 18, 2016
7825060
Bump to 0.27.0.
jgm Nov 18, 2016
cc625a9
Update changelog.
jgm Nov 18, 2016
da380e0
Set policy for CMP0063 to avoid a warning.
jgm Nov 18, 2016
61c3be4
Improve afl target. Use afl-clang by default. Set default for path.
jgm Nov 18, 2016
ce2a6a8
Put set_policy under cmake version test.
jgm Nov 19, 2016
436c010
Use VERSION_GREATER to clean up cmake version test.
jgm Nov 19, 2016
4d2f310
Bump version to 0.27.1, update changelog.
jgm Nov 19, 2016
838cece
Remove redundant cmake_minimum_required.
jgm Nov 24, 2016
8ed5c9d
Fixed pathological cases with backtick code spans:
jgm Nov 26, 2016
2efea7a
Inlines: Ensure that the delimiter stack is freed in subject.
jgm Nov 26, 2016
450c43b
Added pathological test for backticks.
jgm Nov 26, 2016
ea68f88
Allocate enough bytes for backticks array.
jgm Nov 26, 2016
a9da678
Allow balanced nested parens in link destinations (#166)
Dec 1, 2016
9f6be5b
Update CaseFolding to latest (#168)
kainjow Dec 3, 2016
76d39d0
Fixed some warnings in scanners.re.
jgm Dec 5, 2016
6068d6e
Makefile: use warnings with re2c.
jgm Dec 5, 2016
f461630
scanners.re - fixed warnings; use * for fallback.
jgm Dec 5, 2016
847b501
scanners.c generated with re2c 0.16 (68K smaller!).
jgm Dec 5, 2016
5255e2d
Added 'make newbench'.
jgm Dec 6, 2016
29c46c5
Correctly initialize chunk in S_process_line (#170)
nwellnhof Dec 9, 2016
9e64372
More sourcepos! (#169)
MathieuDuponchelle Dec 20, 2016
c4c1d59
wrapper.py: remove unused (and faulty) libc instantiation (#175)
MathieuDuponchelle Dec 24, 2016
4fbe344
Change types for source map offsets (#174)
nwellnhof Dec 31, 2016
26182bb
Update cmark.3 man page.
jgm Dec 31, 2016
cc50a3a
Fix "multiple of 3" determination in emph/strong parsing.
jgm Jan 4, 2017
60b6962
Revert "Change types for source map offsets (#174)"
jgm Jan 4, 2017
bce3f59
Revert "Update cmark.3 man page."
jgm Jan 4, 2017
5a3f747
Revert "wrapper.py: remove unused (and faulty) libc instantiation (#1…
jgm Jan 4, 2017
fb6356e
Revert "More sourcepos! (#169)"
jgm Jan 4, 2017
39c69d0
Added regression test for #177.
jgm Jan 4, 2017
0453926
Slight improvement of clarity of logic in emph matching.
jgm Jan 4, 2017
b5c4a22
Added pathological test for #178 (quadratic).
jgm Jan 4, 2017
a8d5bd4
Fixes #178, quadratic parsing bug.
jgm Jan 4, 2017
64a4c37
Cleaned up setting of lower bounds for openers.
jgm Jan 5, 2017
96a40c9
Added a test for NULL when freeing subj->last_delim.
jgm Jan 5, 2017
c786cac
Automatic code reformatting.
jgm Jan 5, 2017
7031efc
Added support for built-in ${LIB_SUFFIX} feature
winterheart Jan 4, 2017
c9c18ff
Make shared and static libraries optional
winterheart Jan 4, 2017
3894dbd
Merge pull request #179 from winterheart/cmake
jgm Jan 6, 2017
5eb01d2
Fixes for the LaTeX renderer (#182)
Jan 7, 2017
fe58a92
Update spec.
jgm Jan 7, 2017
06156fd
Update emphasis parsing for spec change.
jgm Jan 7, 2017
664b860
Fixed buffer overflow error in S_parser_feed.
jgm Jan 20, 2017
118ebb3
libcmark.pc: use CMAKE_INSTALL_LIBDIR (#185)
juhp Feb 5, 2017
5c2f334
Print message to stderr when we abort due to memory demands.
jgm Apr 3, 2017
3aaf804
Removed coercion in error message when aborting from buffer.
jgm Apr 3, 2017
b75890e
Removed abort outside of conditional (typo).
jgm Apr 3, 2017
12501f1
Fixed code for freeing delimiter stack.
jgm Apr 3, 2017
6313fff
Remove normalize as an option per #190 (#194)
May 5, 2017
f47c5ec
Re-add CMARK_OPT_NORMALIZE without effect.
May 7, 2017
f5c9422
README: Add link to cmark-scala (#196)
tindzk May 15, 2017
3c11019
Prettify languages list
kapyshin May 16, 2017
1fff711
Add link to Python wrapper
kapyshin May 16, 2017
ff1d54e
Merge pull request #198 from PavloKapyshin/master
jgm May 18, 2017
58b37ae
Use CMARK_NO_DELIM for bullet lists. Closes #201.
jgm May 30, 2017
0b1886c
Fixed cmark_node_get_list_start to return 0 for bullet lists...
jgm Jun 2, 2017
14ea489
Fixed bug with unescaped left angle bracket in link destination.
jgm Jun 2, 2017
6ec3b48
Properly handle backslashes in link destinations.
jgm Jun 2, 2017
f907382
Document cases where get_ functions return NULL.
jgm Jun 2, 2017
f3026b8
Merge pull request #195 from github/revert-194-upstream/remove-normalize
jgm Jun 2, 2017
c161a9a
Don't scan past an EOL
Jun 21, 2017
cc24db4
Don't scan past newline either
Jun 21, 2017
60aa732
Merge pull request #205 from github/dont-scan-past-eol
jgm Jun 21, 2017
55b029f
Reset bytes after UTF8 proc
Jun 23, 2017
00291fd
Merge pull request #207 from github/upstream/oob-read
jgm Jun 23, 2017
8628697
Add hyphen to dictionary
philipturnbull Jun 23, 2017
70a6a16
Move fuzzing dictionary into single file
philipturnbull Jun 23, 2017
c1dea4e
Add Makefile target and harness to fuzz with libFuzzer
philipturnbull Jun 26, 2017
a2f1f76
Check for NULL pointer in get_link_type
philipturnbull Jun 26, 2017
153116f
Merge pull request #209 from philipturnbull/libFuzzer
jgm Jun 27, 2017
09d96cd
Makefile: add libFuzzer to phony
jgm Jun 29, 2017
f8737b1
latex writer: fix memory overflow.
jgm Jun 29, 2017
6e8f0bf
Fixed undefined shift in commonmark writer.
jgm Jun 29, 2017
f953e0e
DeMorgan simplification of some tests in emphasis parser.
jgm Jun 29, 2017
4b83812
Updated spec.txt.
jgm Jun 29, 2017
ff28e0d
Avoid memcpy'ing NULL pointers
philipturnbull Jul 5, 2017
c07bb95
Use unsigned integer when shifting
philipturnbull Jul 6, 2017
5c3e831
Merge pull request #212 from github/upstream/memcpy-nonnull
jgm Jul 11, 2017
88c8ad1
Merge pull request #213 from github/upstream/undefined-shift
jgm Jul 11, 2017
45f4fc9
> 32 nested balanced parens in a link is bananas
kivikakk Jul 12, 2017
1ea9cd8
Reverted mistaken fix to #193.
jgm Jul 13, 2017
7423fef
Fix URL scanner.
kivikakk Jul 17, 2017
ffde061
Merge pull request #219 from github/upstream/left-angle-link
jgm Jul 25, 2017
d695e66
Advertise --validate-utf8 in usage information
pclouds Aug 1, 2017
022a55f
Update spec.
jgm Aug 1, 2017
55d75ef
Bump version to 0.28.0.
jgm Aug 1, 2017
08962df
Update changelog.
jgm Aug 1, 2017
ce5d8e3
Merge pull request #221 from pclouds/document-validate-utf8
jgm Aug 1, 2017
15a9f80
Merge branch 'master' of github.com:jgm/cmark
jgm Aug 1, 2017
8982a56
Update changelog.
jgm Aug 1, 2017
4c670c9
Update spec.
jgm Aug 1, 2017
7c5f2bd
Fix typo
kapyshin Aug 2, 2017
4b10d32
Merge pull request #222 from PavloKapyshin/master
jgm Aug 2, 2017
350d145
Update README.md, replace 'make astyle' with 'make format'
pclouds Aug 3, 2017
1a4a339
Reformat source code with 'make format'
pclouds Aug 3, 2017
61b51fa
Merge pull request #224 from pclouds/make-format-source-code
jgm Aug 3, 2017
919cdb2
Add sourcepos info for inlines
kivikakk Aug 9, 2017
b9c7a49
--smart: open quote can never occur right after `]` or `)`.
jgm Aug 9, 2017
e22d1b4
Fix inlines spanning newlines, text in non-para
kivikakk Aug 9, 2017
9853666
Skip sourcepos tracking if disabled
kivikakk Aug 10, 2017
99c5675
Add more pathological tests.
mity Aug 16, 2017
6c9b4d7
blocks: Fix quadratic behavior in `finalize`
vmg Sep 7, 2017
ec9db91
Merge pull request #232 from github/upstream/refparse
jgm Sep 14, 2017
afc9a17
Don't use CMAKE_INSTALL_LIBDIR to create libcmark.pc.
jgm Oct 10, 2017
749e5f1
Bump to 0.28.1, update changelog.
jgm Oct 11, 2017
a54e12c
Fixed regression in install dest for static library.
jgm Oct 12, 2017
e97d8f3
Bump to 0.28.2, update changelog.
jgm Oct 12, 2017
4f98864
Include GNUInstallDirs in src/CMakeLists.txt
nwellnhof Oct 19, 2017
1e5cef9
Merge pull request #240 from nwellnhof/add-cmake-include
jgm Oct 20, 2017
a2e06fa
BUmp to 0.28.3
jgm Oct 21, 2017
5da792f
Updated changelog.
jgm Oct 21, 2017
1326fd0
Merge branch 'master' into upstream/inline-sourcepos
Nov 2, 2017
b40ecdc
Merge pull request #228 from github/upstream/inline-sourcepos
jgm Nov 5, 2017
c739195
Merge pull request #217 from github/upstream/limit-nested-parens
jgm Nov 5, 2017
ed990f5
Merge pull request #230 from mity/more-pathological-tests
jgm Nov 5, 2017
cb27409
Refactored pathological_tests.py
jgm Nov 5, 2017
4db1f75
Add timeout to pathological_tests.py.
jgm Nov 5, 2017
1998db8
Add allowed failures to pathological_tests.py.
jgm Nov 5, 2017
0378b31
Fixed exit code for pathological tests.
jgm Nov 5, 2017
9ead98d
Generate export header for static-only build
nwellnhof Nov 14, 2017
9983c87
Merge pull request #249 from nwellnhof/static-only-build
jgm Nov 15, 2017
db63ea9
Updated travis badges and issue tracker jgm -> commonmark.
jgm Nov 16, 2017
736d8a3
Rename roundtrip and entity tests
nwellnhof Nov 18, 2017
772c4cb
Also run API tests with CMARK_SHARED=OFF
nwellnhof Nov 18, 2017
9253cbf
Add static-only build to Travis test matrix
nwellnhof Nov 18, 2017
9f279be
Merge pull request #250 from nwellnhof/test-static-only-build
jgm Nov 18, 2017
a5c83d7
README - use commonmark/cmark for appveyor badge.
jgm Nov 18, 2017
0fc7c24
Update spec.txt from repository.
jgm Mar 25, 2018
4226e42
Don't allow list markers to be indented >= 4 spaces.
jgm Mar 25, 2018
ed64489
Fix inline raw HTML parsing.
jgm Mar 25, 2018
9d1033c
Adjust max length of decimal/numeric entities.
jgm Mar 25, 2018
8ea2cbd
Update spec.
jgm Mar 26, 2018
55d7b88
Allow spaces in link destination delimited with pointy brackets.
jgm Mar 26, 2018
d51bb0e
Optimize S_find_first_nonspace.
jgm Apr 15, 2018
02c7e76
pathological_tests.py: added test for deeply nested lists.
jgm Apr 15, 2018
9f8ef82
pathological_tests.py: make tests run faster.
jgm Apr 15, 2018
c5189b7
Removed meta from list of block tags.
jgm Jun 11, 2018
26f5144
Fix spaces on regression test.
jgm Jun 11, 2018
55afc6f
Add xml:space="preserve" in XML output when appropriate
pclouds Aug 1, 2017
a803a35
add link parsing corner cases to regressions
kivikakk Jul 16, 2018
5c3ef83
Merge pull request #259 from github/link-parsing-corner-cases
jgm Jul 19, 2018
62ad44e
entity_tests.py - omit noisy success output.
jgm Aug 25, 2018
76478c7
Update spec.txt.
jgm Aug 25, 2018
8800396
Code span spec changes.
jgm Aug 25, 2018
15a76de
Updated spec.txt.
jgm Aug 26, 2018
14ae4f3
Simplify code normalization, in line with spec change.
jgm Aug 26, 2018
a9f67da
Fix appveyor links.
jgm Aug 27, 2018
bec7ee2
build: only attempt to install MSVC system libraries on Windows
compnerd Sep 5, 2018
102d254
Merge pull request #265 from compnerd/upstream-windows-cross-compile
jgm Sep 6, 2018
c981704
Update spec.txt.
jgm Sep 10, 2018
d064263
Check for whitespace before reference title.
jgm Sep 10, 2018
63c675f
Update spec.txt.
jgm Sep 10, 2018
0707ada
XSLT stylesheet to convert cmark XML back to Commonmark
nwellnhof Sep 14, 2018
75870fb
Minor fixes to xml2md.xsl
nwellnhof Sep 14, 2018
c44bced
Merge pull request #267 from nwellnhof/xml2md
jgm Sep 14, 2018
42cd523
Merge pull request #257 from pclouds/xml-space-preserve
jgm Sep 14, 2018
74d46d8
Update spec.txt.
jgm Oct 4, 2018
289a0aa
Update scanners for new info string rules.
jgm Oct 4, 2018
599a160
commonmark writer: use ~~~ fences if info string contains backtick.
jgm Oct 4, 2018
1c08c74
Fix a typo in houdini_href_e.c
felixonmars Oct 8, 2018
f182ed3
Merge pull request #272 from felixonmars/patch-2
jgm Oct 8, 2018
3a440af
render.c: reset last_breakable after cr.
jgm Nov 1, 2018
462cab4
add failing test
kivikakk Nov 12, 2018
cfba1fc
expand tests
kivikakk Nov 13, 2018
d479c28
copy line/col info straight from opener/closer
kivikakk Nov 13, 2018
b1556b3
Merge pull request #275 from github/inline-sourcepos-off
jgm Nov 13, 2018
6511028
Use pledge(2) on OpenBSD
kivikakk Nov 20, 2018
0d6062b
check for OpenBSD 5.9+
kivikakk Nov 21, 2018
f079389
Merge pull request #278 from github/upstream-pledge
jgm Nov 23, 2018
cd8a1cd
Merge branch 'commommark-master' into update-branch
nkcsgexi Dec 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ language: c
compiler:
- clang
- gcc
matrix:
include:
- os: linux
compiler: gcc
env: CMAKE_OPTIONS="-DCMARK_SHARED=OFF"
addons:
apt:
# we need a more recent cmake than travis/linux provides (at least 2.8.9):
sources:
- kubuntu-backports
- kalakris-cmake
packages:
- cmake
- python3
Expand All @@ -23,14 +29,10 @@ before_install:
then
echo "Building without python3, to make sure that works."
fi

script:
- make
- (mkdir -p build && cd build && cmake $CMAKE_OPTIONS ..)
- make test
- |
if [ ${TRAVIS_OS_NAME:-'linux'} = 'linux' ]
then
make roundtrip_test
fi
- |
if [ ${TRAVIS_OS_NAME:-'linux'} = 'linux' ]
then
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
project(cmark)
cmake_minimum_required(VERSION 2.8.9)

# prevent ugly developer warnings because version is set directly, not through project()
# it should be redone properly by using VERSION in project() if on CMake 3.x
if(CMAKE_MAJOR_VERSION GREATER 2)
cmake_policy(SET CMP0048 OLD)
endif()

project(cmark)

include("FindAsan.cmake")

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
Expand All @@ -9,14 +17,17 @@ endif()
set(PROJECT_NAME "cmark")

set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 22)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_MINOR 28)
set(PROJECT_VERSION_PATCH 3)
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )

option(CMARK_TESTS "Build cmark tests and enable testing" ON)
option(CMARK_STATIC "Build static libcmark library" ON)
option(CMARK_SHARED "Build shared libcmark library" ON)
option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF)

add_subdirectory(src)
if(CMARK_TESTS)
if(CMARK_TESTS AND (CMARK_SHARED OR CMARK_STATIC))
add_subdirectory(api_test)
endif()
add_subdirectory(man)
Expand Down
26 changes: 2 additions & 24 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-----

houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c,
html_unescape.gperf, html_unescape.h
houdini.h, houdini_href_e.c, houdini_html_e.c, houdini_html_u.c

derive from https://github.com/vmg/houdini (with some modifications)

Expand Down Expand Up @@ -104,7 +103,7 @@ DEALINGS IN THE SOFTWARE.

-----

The normalization code in runtests.py was derived from the
The normalization code in normalize.py was derived from the
markdowntest project, Copyright 2013 Karl Dubost:

The MIT License (MIT)
Expand Down Expand Up @@ -169,24 +168,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-----

The normalization code in runtests.py was derived from the
markdowntest project, Copyright 2013 Karl Dubost:

The MIT License (MIT)

Copyright (c) 2013 Karl Dubost

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90 changes: 54 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,28 @@ SITE=_site
SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' $(SPEC))
FUZZCHARS?=2000000 # for fuzztest
BENCHDIR=bench
BENCHSAMPLES=$(wildcard $(BENCHDIR)/samples/*.md)
BENCHFILE=$(BENCHDIR)/benchinput.md
ALLTESTS=alltests.md
NUMRUNS?=10
CMARK=$(BUILDDIR)/src/cmark
CMARK_FUZZ=$(BUILDDIR)/src/cmark-fuzz
PROG?=$(CMARK)
BENCHINP?=README.md
VERSION?=$(SPECVERSION)
RELEASE?=CommonMark-$(VERSION)
INSTALL_PREFIX?=/usr/local
CLANG_CHECK?=clang-check
CLANG_FORMAT=clang-format -style llvm -sort-includes=0 -i
AFL_PATH?=/usr/local/bin

.PHONY: all cmake_build spec leakcheck clean fuzztest dingus upload test update-site upload-site debug ubsan asan mingw archive bench format update-spec afl clang-check
.PHONY: all cmake_build leakcheck clean fuzztest test debug ubsan asan mingw archive newbench bench format update-spec afl clang-check libFuzzer

all: cmake_build man/man3/cmark.3

$(CMARK): cmake_build

cmake_build: $(BUILDDIR)
@make -j2 -C $(BUILDDIR)
@$(MAKE) -j2 -C $(BUILDDIR)
@echo "Binaries can be found in $(BUILDDIR)/src"

$(BUILDDIR):
Expand All @@ -41,52 +44,59 @@ $(BUILDDIR):
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON

install: $(BUILDDIR)
make -C $(BUILDDIR) install
$(MAKE) -C $(BUILDDIR) install

debug:
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
cmake .. -DCMAKE_BUILD_TYPE=Debug; \
make
$(MAKE)

ubsan:
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
cmake .. -DCMAKE_BUILD_TYPE=Ubsan; \
make
$(MAKE)

asan:
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
cmake .. -DCMAKE_BUILD_TYPE=Asan; \
make
$(MAKE)

prof:
mkdir -p $(BUILDDIR); \
cd $(BUILDDIR); \
cmake .. -DCMAKE_BUILD_TYPE=Profile; \
make
$(MAKE)

afl:
@[ -n "$(AFL_PATH)" ] || { echo '$$AFL_PATH not set'; false; }
mkdir -p $(BUILDDIR)
cd $(BUILDDIR) && cmake .. -DCMAKE_C_COMPILER=$(AFL_PATH)/afl-gcc
make
cd $(BUILDDIR) && cmake .. -DCMAKE_C_COMPILER=$(AFL_PATH)/afl-clang
$(MAKE)
$(AFL_PATH)/afl-fuzz \
-i test/afl_test_cases \
-o test/afl_results \
-x test/afl_dictionary \
-x test/fuzzing_dictionary \
-t 100 \
$(CMARK) $(CMARK_OPTS)

libFuzzer:
@[ -n "$(LIB_FUZZER_PATH)" ] || { echo '$$LIB_FUZZER_PATH not set'; false; }
mkdir -p $(BUILDDIR)
cd $(BUILDDIR) && cmake -DCMAKE_BUILD_TYPE=Asan -DCMARK_LIB_FUZZER=ON -DCMAKE_LIB_FUZZER_PATH=$(LIB_FUZZER_PATH) ..
$(MAKE) -j2 -C $(BUILDDIR) cmark-fuzz
test/run-cmark-fuzz $(CMARK_FUZZ)

clang-check: all
${CLANG_CHECK} -p build -analyze src/*.c

mingw:
mkdir -p $(MINGW_BUILDDIR); \
cd $(MINGW_BUILDDIR); \
cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$(MINGW_INSTALLDIR) ;\
make && make install
$(MAKE) && $(MAKE) install

man/man3/cmark.3: src/cmark.h | $(CMARK)
python man/make_man_page.py $< > $@ \
Expand All @@ -100,22 +110,21 @@ clean:

# We include case_fold_switch.inc in the repository, so this shouldn't
# normally need to be generated.
$(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
$(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding.txt
perl tools/mkcasefold.pl < $< > $@

# We include scanners.c in the repository, so this shouldn't
# normally need to be generated.
$(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
@case "$$(re2c -v)" in \
*\ 0.13.7*|*\ 0.14|*\ 0.14.1) \
echo "re2c versions 0.13.7 through 0.14.1 are known to produce buggy code."; \
echo "Try a version >= 0.14.2 or <= 0.13.6."; \
*\ 0.13.*|*\ 0.14|*\ 0.14.1) \
echo "re2c >= 0.14.2 is required"; \
false; \
;; \
esac
re2c --case-insensitive -b -i --no-generation-date -8 \
re2c -W -Werror --case-insensitive -b -i --no-generation-date -8 \
--encoding-policy substitute -o $@ $<
clang-format -style llvm -i $@
$(CLANG_FORMAT) $@

# We include entities.inc in the repository, so normally this
# doesn't need to be regenerated:
Expand All @@ -127,23 +136,18 @@ update-spec:
> $(SPEC)

test: $(SPEC) cmake_build
make -C $(BUILDDIR) test || (cat $(BUILDDIR)/Testing/Temporary/LastTest.log && exit 1)

roundtrip_test: $(SPEC) cmake_build
python3 test/spec_tests.py --spec $< --prog test/roundtrip.sh
$(MAKE) -C $(BUILDDIR) test || (cat $(BUILDDIR)/Testing/Temporary/LastTest.log && exit 1)

$(ALLTESTS): $(SPEC)
python3 test/spec_tests.py --spec $< --dump-tests | python3 -c 'import json; import sys; tests = json.loads(sys.stdin.read()); print("\n".join([test["markdown"] for test in tests]))' > $@

leakcheck: $(ALLTESTS)
rc=0; \
for format in html man xml latex commonmark; do \
for opts in "" "--smart" "--normalize"; do \
for opts in "" "--smart"; do \
echo "cmark -t $$format $$opts" ; \
cat $< | valgrind -q --leak-check=full --dsymutil=yes --error-exitcode=1 $(PROG) -t $$format $$opts >/dev/null || rc=1; \
valgrind -q --leak-check=full --dsymutil=yes --error-exitcode=1 $(PROG) -t $$format $$opts $(ALLTESTS) >/dev/null || exit 1;\
done; \
done; \
exit $$rc
done;

fuzztest:
{ for i in `seq 1 10`; do \
Expand All @@ -154,25 +158,39 @@ fuzztest:
progit:
git clone https://github.com/progit/progit.git

$(BENCHDIR)/benchinput.md: progit
$(BENCHFILE): progit
echo "" > $@
for lang in ar az be ca cs de en eo es es-ni fa fi fr hi hu id it ja ko mk nl no-nb pl pt-br ro ru sr th tr uk vi zh zh-tw; do \
cat progit/$$lang/*/*.markdown >> $@; \
for i in `seq 1 10`; do \
cat progit/$$lang/*/*.markdown >> $@; \
done; \
done

# for more accurate results, run with
# sudo renice -10 $$; make bench
bench: $(BENCHFILE)
{ sudo renice -10 $$$$; \
for x in `seq 1 $(NUMRUNS)` ; do \
/usr/bin/env time -p $(PROG) </dev/null >/dev/null ; \
/usr/bin/env time -p $(PROG) $< >/dev/null ; \
done \
{ for x in `seq 1 $(NUMRUNS)` ; do \
/usr/bin/env time -p $(PROG) </dev/null >/dev/null ; \
/usr/bin/env time -p $(PROG) $< >/dev/null ; \
done \
} 2>&1 | grep 'real' | awk '{print $$2}' | python3 'bench/stats.py'

newbench:
for f in $(BENCHSAMPLES) ; do \
printf "%26s " `basename $$f` ; \
{ for x in `seq 1 $(NUMRUNS)` ; do \
/usr/bin/env time -p $(PROG) </dev/null >/dev/null ; \
for x in `seq 1 200` ; do cat $$f ; done | \
/usr/bin/env time -p $(PROG) > /dev/null; \
done \
} 2>&1 | grep 'real' | awk '{print $$2}' | \
python3 'bench/stats.py'; done

format:
clang-format -style llvm -i src/*.c src/*.h
$(CLANG_FORMAT) src/*.c src/*.h api_test/*.c api_test/*.h

operf: $(CMARK)
operf $< < $(BENCHINP) > /dev/null
operf $< < $(BENCHFILE) > /dev/null

distclean: clean
-rm -rf *.dSYM
Expand Down
Loading