commonmarker 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/Rakefile +0 -5
- data/ext/commonmarker/cmark/CMakeLists.txt +1 -1
- data/ext/commonmarker/cmark/Makefile +12 -7
- data/ext/commonmarker/cmark/README.md +12 -8
- data/ext/commonmarker/cmark/api_test/main.c +18 -2
- data/ext/commonmarker/cmark/benchmarks.md +4 -4
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +12 -12
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +106 -106
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +7 -7
- data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +1 -1
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/DependInfo.cmake +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/build.make +61 -9
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/cmake_clean.cmake +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark.dir/progress.make +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/DependInfo.cmake +3 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/build.make +81 -29
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/cmake_clean.cmake +3 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark.dir/progress.make +19 -17
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/C.includecache +56 -10
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/DependInfo.cmake +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/build.make +60 -8
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmake_clean.cmake +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.internal +27 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/depend.make +27 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/flags.make +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/link.txt +1 -1
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/progress.make +19 -17
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/render.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -1
- data/ext/commonmarker/cmark/build/src/Makefile +66 -0
- data/ext/commonmarker/cmark/build/src/cmake_install.cmake +3 -3
- data/ext/commonmarker/cmark/build/src/cmark_version.h +2 -2
- data/ext/commonmarker/cmark/build/src/libcmark.a +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark.pc +1 -1
- data/ext/commonmarker/cmark/changelog.txt +144 -0
- data/ext/commonmarker/cmark/man/make_man_page.py +3 -3
- data/ext/commonmarker/cmark/man/man1/cmark.1 +10 -2
- data/ext/commonmarker/cmark/man/man3/cmark.3 +106 -85
- data/ext/commonmarker/cmark/src/CMakeLists.txt +5 -2
- data/ext/commonmarker/cmark/src/blocks.c +76 -9
- data/ext/commonmarker/cmark/src/cmark.c +9 -2
- data/ext/commonmarker/cmark/src/cmark.h +16 -3
- data/ext/commonmarker/cmark/src/commonmark.c +162 -309
- data/ext/commonmarker/cmark/src/html.c +30 -10
- data/ext/commonmarker/cmark/src/inlines.c +80 -72
- data/ext/commonmarker/cmark/src/latex.c +430 -0
- data/ext/commonmarker/cmark/src/main.c +12 -4
- data/ext/commonmarker/cmark/src/man.c +118 -156
- data/ext/commonmarker/cmark/src/node.h +1 -0
- data/ext/commonmarker/cmark/src/render.c +186 -0
- data/ext/commonmarker/cmark/src/render.h +66 -0
- data/ext/commonmarker/cmark/src/scanners.c +14586 -8944
- data/ext/commonmarker/cmark/src/scanners.h +16 -2
- data/ext/commonmarker/cmark/src/scanners.re +93 -9
- data/ext/commonmarker/cmark/test/__pycache__/cmark.cpython-34.pyc +0 -0
- data/ext/commonmarker/cmark/test/__pycache__/normalize.cpython-34.pyc +0 -0
- data/ext/commonmarker/cmark/test/smart_punct.txt +74 -10
- data/ext/commonmarker/cmark/test/spec.txt +726 -92
- data/ext/commonmarker/cmark/test/spec_tests.py +16 -13
- data/lib/commonmarker/config.rb +2 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/test_spec.rb +11 -10
- metadata +9 -6
- data/ext/commonmarker/cmark/algorithm.md +0 -116
- data/ext/commonmarker/cmark/src/debug.h +0 -36
- data/test/spec_tests.json +0 -4482
@@ -2,7 +2,7 @@
|
|
2
2
|
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
|
3
3
|
|
4
4
|
# compile C with /usr/bin/cc
|
5
|
-
C_FLAGS = -fPIC -fvisibility=hidden -Wall -Wextra -std=c99 -pedantic -O3 -DNDEBUG -I/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/src/. -I/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src
|
5
|
+
C_FLAGS = -fPIC -fvisibility=hidden -Wall -Wextra -std=c99 -pedantic -O3 -DNDEBUG -fPIC -I/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/src/. -I/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src
|
6
6
|
|
7
7
|
C_DEFINES =
|
8
8
|
|
Binary file
|
Binary file
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/usr/bin/ar cr libcmark.a CMakeFiles/libcmark_static.dir/cmark.c.o CMakeFiles/libcmark_static.dir/node.c.o CMakeFiles/libcmark_static.dir/iterator.c.o CMakeFiles/libcmark_static.dir/blocks.c.o CMakeFiles/libcmark_static.dir/inlines.c.o CMakeFiles/libcmark_static.dir/scanners.c.o CMakeFiles/libcmark_static.dir/utf8.c.o CMakeFiles/libcmark_static.dir/buffer.c.o CMakeFiles/libcmark_static.dir/references.c.o CMakeFiles/libcmark_static.dir/man.c.o CMakeFiles/libcmark_static.dir/xml.c.o CMakeFiles/libcmark_static.dir/html.c.o CMakeFiles/libcmark_static.dir/commonmark.c.o CMakeFiles/libcmark_static.dir/houdini_href_e.c.o CMakeFiles/libcmark_static.dir/houdini_html_e.c.o CMakeFiles/libcmark_static.dir/houdini_html_u.c.o CMakeFiles/libcmark_static.dir/cmark_ctype.c.o
|
1
|
+
/usr/bin/ar cr libcmark.a CMakeFiles/libcmark_static.dir/cmark.c.o CMakeFiles/libcmark_static.dir/node.c.o CMakeFiles/libcmark_static.dir/iterator.c.o CMakeFiles/libcmark_static.dir/blocks.c.o CMakeFiles/libcmark_static.dir/inlines.c.o CMakeFiles/libcmark_static.dir/scanners.c.o CMakeFiles/libcmark_static.dir/utf8.c.o CMakeFiles/libcmark_static.dir/buffer.c.o CMakeFiles/libcmark_static.dir/references.c.o CMakeFiles/libcmark_static.dir/render.c.o CMakeFiles/libcmark_static.dir/man.c.o CMakeFiles/libcmark_static.dir/xml.c.o CMakeFiles/libcmark_static.dir/html.c.o CMakeFiles/libcmark_static.dir/commonmark.c.o CMakeFiles/libcmark_static.dir/latex.c.o CMakeFiles/libcmark_static.dir/houdini_href_e.c.o CMakeFiles/libcmark_static.dir/houdini_html_e.c.o CMakeFiles/libcmark_static.dir/houdini_html_u.c.o CMakeFiles/libcmark_static.dir/cmark_ctype.c.o
|
2
2
|
/usr/bin/ranlib libcmark.a
|
Binary file
|
@@ -1,18 +1,20 @@
|
|
1
|
-
CMAKE_PROGRESS_1 =
|
2
|
-
CMAKE_PROGRESS_2 =
|
3
|
-
CMAKE_PROGRESS_3 =
|
4
|
-
CMAKE_PROGRESS_4 =
|
5
|
-
CMAKE_PROGRESS_5 =
|
6
|
-
CMAKE_PROGRESS_6 =
|
7
|
-
CMAKE_PROGRESS_7 =
|
8
|
-
CMAKE_PROGRESS_8 =
|
9
|
-
CMAKE_PROGRESS_9 =
|
10
|
-
CMAKE_PROGRESS_10 =
|
11
|
-
CMAKE_PROGRESS_11 =
|
12
|
-
CMAKE_PROGRESS_12 =
|
13
|
-
CMAKE_PROGRESS_13 =
|
14
|
-
CMAKE_PROGRESS_14 =
|
15
|
-
CMAKE_PROGRESS_15 =
|
16
|
-
CMAKE_PROGRESS_16 =
|
17
|
-
CMAKE_PROGRESS_17 =
|
1
|
+
CMAKE_PROGRESS_1 = 43
|
2
|
+
CMAKE_PROGRESS_2 = 44
|
3
|
+
CMAKE_PROGRESS_3 = 45
|
4
|
+
CMAKE_PROGRESS_4 = 46
|
5
|
+
CMAKE_PROGRESS_5 = 47
|
6
|
+
CMAKE_PROGRESS_6 = 48
|
7
|
+
CMAKE_PROGRESS_7 = 49
|
8
|
+
CMAKE_PROGRESS_8 = 50
|
9
|
+
CMAKE_PROGRESS_9 = 51
|
10
|
+
CMAKE_PROGRESS_10 = 52
|
11
|
+
CMAKE_PROGRESS_11 = 53
|
12
|
+
CMAKE_PROGRESS_12 = 54
|
13
|
+
CMAKE_PROGRESS_13 = 55
|
14
|
+
CMAKE_PROGRESS_14 = 56
|
15
|
+
CMAKE_PROGRESS_15 = 57
|
16
|
+
CMAKE_PROGRESS_16 = 58
|
17
|
+
CMAKE_PROGRESS_17 = 59
|
18
|
+
CMAKE_PROGRESS_18 = 60
|
19
|
+
CMAKE_PROGRESS_19 = 61
|
18
20
|
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
58
|
@@ -524,6 +524,36 @@ iterator.c.s:
|
|
524
524
|
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/iterator.c.s
|
525
525
|
.PHONY : iterator.c.s
|
526
526
|
|
527
|
+
latex.o: latex.c.o
|
528
|
+
.PHONY : latex.o
|
529
|
+
|
530
|
+
# target to build an object file
|
531
|
+
latex.c.o:
|
532
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/latex.c.o
|
533
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/latex.c.o
|
534
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/latex.c.o
|
535
|
+
.PHONY : latex.c.o
|
536
|
+
|
537
|
+
latex.i: latex.c.i
|
538
|
+
.PHONY : latex.i
|
539
|
+
|
540
|
+
# target to preprocess a source file
|
541
|
+
latex.c.i:
|
542
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/latex.c.i
|
543
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/latex.c.i
|
544
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/latex.c.i
|
545
|
+
.PHONY : latex.c.i
|
546
|
+
|
547
|
+
latex.s: latex.c.s
|
548
|
+
.PHONY : latex.s
|
549
|
+
|
550
|
+
# target to generate assembly for a file
|
551
|
+
latex.c.s:
|
552
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/latex.c.s
|
553
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/latex.c.s
|
554
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/latex.c.s
|
555
|
+
.PHONY : latex.c.s
|
556
|
+
|
527
557
|
main.o: main.c.o
|
528
558
|
.PHONY : main.o
|
529
559
|
|
@@ -638,6 +668,36 @@ references.c.s:
|
|
638
668
|
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/references.c.s
|
639
669
|
.PHONY : references.c.s
|
640
670
|
|
671
|
+
render.o: render.c.o
|
672
|
+
.PHONY : render.o
|
673
|
+
|
674
|
+
# target to build an object file
|
675
|
+
render.c.o:
|
676
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/render.c.o
|
677
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/render.c.o
|
678
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/render.c.o
|
679
|
+
.PHONY : render.c.o
|
680
|
+
|
681
|
+
render.i: render.c.i
|
682
|
+
.PHONY : render.i
|
683
|
+
|
684
|
+
# target to preprocess a source file
|
685
|
+
render.c.i:
|
686
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/render.c.i
|
687
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/render.c.i
|
688
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/render.c.i
|
689
|
+
.PHONY : render.c.i
|
690
|
+
|
691
|
+
render.s: render.c.s
|
692
|
+
.PHONY : render.s
|
693
|
+
|
694
|
+
# target to generate assembly for a file
|
695
|
+
render.c.s:
|
696
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/cmark.dir/build.make src/CMakeFiles/cmark.dir/render.c.s
|
697
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark.dir/build.make src/CMakeFiles/libcmark.dir/render.c.s
|
698
|
+
cd /Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build && $(MAKE) -f src/CMakeFiles/libcmark_static.dir/build.make src/CMakeFiles/libcmark_static.dir/render.c.s
|
699
|
+
.PHONY : render.c.s
|
700
|
+
|
641
701
|
scanners.o: scanners.c.o
|
642
702
|
.PHONY : scanners.o
|
643
703
|
|
@@ -777,6 +837,9 @@ help:
|
|
777
837
|
@echo "... iterator.o"
|
778
838
|
@echo "... iterator.i"
|
779
839
|
@echo "... iterator.s"
|
840
|
+
@echo "... latex.o"
|
841
|
+
@echo "... latex.i"
|
842
|
+
@echo "... latex.s"
|
780
843
|
@echo "... main.o"
|
781
844
|
@echo "... main.i"
|
782
845
|
@echo "... main.s"
|
@@ -789,6 +852,9 @@ help:
|
|
789
852
|
@echo "... references.o"
|
790
853
|
@echo "... references.i"
|
791
854
|
@echo "... references.s"
|
855
|
+
@echo "... render.o"
|
856
|
+
@echo "... render.i"
|
857
|
+
@echo "... render.s"
|
792
858
|
@echo "... scanners.o"
|
793
859
|
@echo "... scanners.i"
|
794
860
|
@echo "... scanners.s"
|
@@ -43,17 +43,17 @@ ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unsp
|
|
43
43
|
|
44
44
|
IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
|
45
45
|
FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES
|
46
|
-
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/libcmark.0.
|
46
|
+
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/libcmark.0.21.0.dylib"
|
47
47
|
"/Users/gjtorikian/Development/commonmarker/ext/commonmarker/cmark/build/src/libcmark.dylib"
|
48
48
|
)
|
49
49
|
FOREACH(file
|
50
|
-
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libcmark.0.
|
50
|
+
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libcmark.0.21.0.dylib"
|
51
51
|
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libcmark.dylib"
|
52
52
|
)
|
53
53
|
IF(EXISTS "${file}" AND
|
54
54
|
NOT IS_SYMLINK "${file}")
|
55
55
|
EXECUTE_PROCESS(COMMAND "/usr/bin/install_name_tool"
|
56
|
-
-id "libcmark.0.
|
56
|
+
-id "libcmark.0.21.0.dylib"
|
57
57
|
"${file}")
|
58
58
|
IF(CMAKE_INSTALL_DO_STRIP)
|
59
59
|
EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "${file}")
|
Binary file
|
@@ -1,3 +1,147 @@
|
|
1
|
+
[0.21.0]
|
2
|
+
|
3
|
+
* Updated to version 0.21 of spec.
|
4
|
+
* Added latex renderer (#31). New exported function in API:
|
5
|
+
`cmark_render_latex`. New source file: `src/latex.hs`.
|
6
|
+
* Updates for new HTML block spec. Removed old `html_block_tag` scanner.
|
7
|
+
Added new `html_block_start` and `html_block_start_7`, as well
|
8
|
+
as `html_block_end_n` for n = 1-5. Rewrote block parser for new HTML
|
9
|
+
block spec.
|
10
|
+
* We no longer preprocess tabs to spaces before parsing.
|
11
|
+
Instead, we keep track of both the byte offset and
|
12
|
+
the (virtual) column as we parse block starts.
|
13
|
+
This allows us to handle tabs without converting
|
14
|
+
to spaces first. Tabs are left as tabs in the output, as
|
15
|
+
per the revised spec.
|
16
|
+
* Removed utf8 validation by default. We now replace null characters
|
17
|
+
in the line splitting code.
|
18
|
+
* Added `CMARK_OPT_VALIDATE_UTF8` option and command-line option
|
19
|
+
`--validate-utf8`. This option causes cmark to check for valid
|
20
|
+
UTF-8, replacing invalid sequences with the replacement
|
21
|
+
character, U+FFFD. Previously this was done by default in
|
22
|
+
connection with tab expansion, but we no longer do it by
|
23
|
+
default with the new tab treatment. (Many applications will
|
24
|
+
know that the input is valid UTF-8, so validation will not
|
25
|
+
be necessary.)
|
26
|
+
* Added `CMARK_OPT_SAFE` option and `--safe` command-line flag.
|
27
|
+
+ Added `CMARK_OPT_SAFE`. This option disables rendering of raw HTML
|
28
|
+
and potentially dangerous links.
|
29
|
+
+ Added `--safe` option in command-line program.
|
30
|
+
+ Updated `cmark.3` man page.
|
31
|
+
+ Added `scan_dangerous_url` to scanners.
|
32
|
+
+ In HTML, suppress rendering of raw HTML and potentially dangerous
|
33
|
+
links if `CMARK_OPT_SAFE`. Dangerous URLs are those that begin
|
34
|
+
with `javascript:`, `vbscript:`, `file:`, or `data:` (except for
|
35
|
+
`image/png`, `image/gif`, `image/jpeg`, or `image/webp` mime types).
|
36
|
+
+ Added `api_test` for `OPT_CMARK_SAFE`.
|
37
|
+
+ Rewrote `README.md` on security.
|
38
|
+
* Limit ordered list start to 9 digits, per spec.
|
39
|
+
* Added width parameter to `render_man` (API change).
|
40
|
+
* Extracted common renderer code from latex, man, and commonmark
|
41
|
+
renderers into a separate module, `renderer.[ch]` (#63). To write a
|
42
|
+
renderer now, you only need to write a character escaping function
|
43
|
+
and a node rendering function. You pass these to `cmark_render`
|
44
|
+
and it handles all the plumbing (including line wrapping) for you.
|
45
|
+
So far this is an internal module, but we might consider adding
|
46
|
+
it to the API in the future.
|
47
|
+
* commonmark writer: correctly handle email autolinks.
|
48
|
+
* commonmark writer: escape `!`.
|
49
|
+
* Fixed soft breaks in commonmark renderer.
|
50
|
+
* Fixed scanner for link url. re2c returns the longest match, so we
|
51
|
+
were getting bad results with `[link](foo\(and\(bar\)\))`
|
52
|
+
which it would parse as containing a bare `\` followed by
|
53
|
+
an in-parens chunk ending with the final paren.
|
54
|
+
* Allow non-initial hyphens in html tag names. This allows for
|
55
|
+
custom tags, see jgm/CommonMark#239.
|
56
|
+
* Updated `test/smart_punct.txt`.
|
57
|
+
* Implemented new treatment of hyphens with `--smart`, converting
|
58
|
+
sequences of hyphens to sequences of em and en dashes that contain no
|
59
|
+
hyphens.
|
60
|
+
* HTML renderer: properly split info on first space char (see
|
61
|
+
jgm/commonmark.js#54).
|
62
|
+
* Changed version variables to functions (#60, Andrius Bentkus).
|
63
|
+
This is easier to access using ffi, since some languages, like C#
|
64
|
+
like to use only function interfaces for accessing library
|
65
|
+
functionality.
|
66
|
+
* `process_emphasis`: Fixed setting lower bound to potential openers.
|
67
|
+
Renamed `potential_openers` -> `openers_bottom`.
|
68
|
+
Renamed `start_delim` -> `stack_bottom`.
|
69
|
+
* Added case for #59 to `pathological_test.py`.
|
70
|
+
* Fixed emphasis/link parsing bug (#59).
|
71
|
+
* Fixed off-by-one error in line splitting routine.
|
72
|
+
This caused certain NULLs not to be replaced.
|
73
|
+
* Don't rtrim in `subject_from_buffer`. This gives bad results in
|
74
|
+
parsing reference links, where we might have trailing blanks
|
75
|
+
(`finalize` removes the bytes parsed as a reference definition;
|
76
|
+
before this change, some blank bytes might remain on the line).
|
77
|
+
+ Added `column` and `first_nonspace_column` fields to `parser`.
|
78
|
+
+ Added utility function to advance the offset, computing
|
79
|
+
the virtual column too. Note that we don't need to deal with
|
80
|
+
UTF-8 here at all. Only ASCII occurs in block starts.
|
81
|
+
+ Significant performance improvement due to the fact that
|
82
|
+
we're not doing UTF-8 validation.
|
83
|
+
* Fixed entity lookup table. The old one had many errors.
|
84
|
+
The new one is derived from the list in the npm entities package.
|
85
|
+
Since the sequences can now be longer (multi-code-point), we
|
86
|
+
have bumped the length limit from 4 to 8, which also affects
|
87
|
+
`houdini_html_u.c`. An example of the kind of error that was fixed:
|
88
|
+
`≧̸` should be rendered as "≧̸" (U+02267 U+00338), but it was
|
89
|
+
being rendered as "≧" (which is the same as `≧`).
|
90
|
+
* Replace gperf-based entity lookup with binary tree lookup.
|
91
|
+
The primary advantage is a big reduction in the size of
|
92
|
+
the compiled library and executable (> 100K).
|
93
|
+
There should be no measurable performance difference in
|
94
|
+
normal documents. I detected only a slight performance
|
95
|
+
hit in a file containing 1,000,000 entities.
|
96
|
+
+ Removed `src/html_unescape.gperf` and `src/html_unescape.h`.
|
97
|
+
+ Added `src/entities.h` (generated by `tools/make_entities_h.py`).
|
98
|
+
+ Added binary tree lookup functions to `houdini_html_u.c`, and
|
99
|
+
use the data in `src/entities.h`.
|
100
|
+
* Renamed `entities.h` -> `entities.inc`, and
|
101
|
+
`tools/make_entities_h.py` -> `tools/make_entitis_inc.py`.
|
102
|
+
* Fixed cases like
|
103
|
+
```
|
104
|
+
[ref]: url
|
105
|
+
"title" ok
|
106
|
+
```
|
107
|
+
Here we should parse the first line as a reference.
|
108
|
+
* `inlines.c`: Added utility functions to skip spaces and line endings.
|
109
|
+
* Fixed backslashes in link destinations that are not part of escapes
|
110
|
+
(jgm/commonmark#45).
|
111
|
+
* `process_line`: Removed "add newline if line doesn't have one."
|
112
|
+
This isn't actually needed.
|
113
|
+
* Small logic fixes and a simplification in `process_emphasis`.
|
114
|
+
* Added more pathological tests:
|
115
|
+
+ Many link closers with no openers.
|
116
|
+
+ Many link openers with no closers.
|
117
|
+
+ Many emph openers with no closers.
|
118
|
+
+ Many closers with no openers.
|
119
|
+
+ `"*a_ " * 20000`.
|
120
|
+
* Fixed `process_emphasis` to handle new pathological cases.
|
121
|
+
Now we have an array of pointers (`potential_openers`),
|
122
|
+
keyed to the delim char. When we've failed to match a potential opener
|
123
|
+
prior to point X in the delimiter stack, we reset `potential_openers`
|
124
|
+
for that opener type to X, and thus avoid having to look again through
|
125
|
+
all the openers we've already rejected.
|
126
|
+
* `process_inlines`: remove closers from delim stack when possible.
|
127
|
+
When they have no matching openers and cannot be openers themselves,
|
128
|
+
we can safely remove them. This helps with a performance case:
|
129
|
+
`"a_ " * 20000` (jgm/commonmark.js#43).
|
130
|
+
* Roll utf8proc_charlen into utf8proc_valid (Nick Wellnhofer).
|
131
|
+
Speeds up "make bench" by another percent.
|
132
|
+
* `spec_tests.py`: allow `→` for tab in HTML examples.
|
133
|
+
* `normalize.py`: don't collapse whitespace in pre contexts.
|
134
|
+
* Use utf-8 aware re2c.
|
135
|
+
* Makefile afl target: removed `-m none`, added `CMARK_OPTS`.
|
136
|
+
* README: added `make afl` instructions.
|
137
|
+
* Limit generated generated `cmark.3` to 72 character line width.
|
138
|
+
* Travis: switched to containerized build system.
|
139
|
+
* Removed `debug.h`. (It uses GNU extensions, and we don't need it anyway.)
|
140
|
+
* Removed sundown from benchmarks, because the reading was anomalous.
|
141
|
+
sundown had an arbitrary 16MB limit on buffers, and the benchmark
|
142
|
+
input exceeded that. So who knows what we were actually testing?
|
143
|
+
Added hoedown, sundown's successor, which is a better comparison.
|
144
|
+
|
1
145
|
[0.20.0]
|
2
146
|
|
3
147
|
* Fixed bug in list item parsing when items indented >= 4 spaces (#52).
|
@@ -31,17 +31,17 @@ parse_document.argtypes = [c_char_p, c_long]
|
|
31
31
|
|
32
32
|
render_man = cmark.cmark_render_man
|
33
33
|
render_man.restype = c_char_p
|
34
|
-
render_man.argtypes = [c_void_p]
|
34
|
+
render_man.argtypes = [c_void_p, c_long, c_long]
|
35
35
|
|
36
36
|
def md2man(text):
|
37
37
|
if sys.version_info >= (3,0):
|
38
38
|
textbytes = text.encode('utf-8')
|
39
39
|
textlen = len(textbytes)
|
40
|
-
return render_man(parse_document(textbytes, textlen)).decode('utf-8')
|
40
|
+
return render_man(parse_document(textbytes, textlen), 0, 65).decode('utf-8')
|
41
41
|
else:
|
42
42
|
textbytes = text
|
43
43
|
textlen = len(text)
|
44
|
-
return render_man(parse_document(textbytes, textlen))
|
44
|
+
return render_man(parse_document(textbytes, textlen), 0, 72)
|
45
45
|
|
46
46
|
comment_start_re = re.compile('^\/\*\* ?')
|
47
47
|
comment_delim_re = re.compile('^[/ ]\** ?')
|
@@ -10,7 +10,7 @@ file*
|
|
10
10
|
.SH "DESCRIPTION"
|
11
11
|
\fBcmark\fR
|
12
12
|
converts Markdown formatted plain text to either HTML, groff man,
|
13
|
-
CommonMark XML, or CommonMark, using the conventions
|
13
|
+
CommonMark XML, LaTeX, or CommonMark, using the conventions
|
14
14
|
described in the CommonMark spec. It reads input from \fIstdin\fR
|
15
15
|
or the specified files (concatenating their contents) and writes
|
16
16
|
output to \fIstdout\fR.
|
@@ -18,7 +18,7 @@ output to \fIstdout\fR.
|
|
18
18
|
.TP 12n
|
19
19
|
.B \-\-to, \-t \f[I]FORMAT\f[]
|
20
20
|
Specify output format (\f[C]html\f[], \f[C]man\f[], \f[C]xml\f[],
|
21
|
-
\f[C]commonmark\f[]).
|
21
|
+
\f[C]latex\f[], \f[C]commonmark\f[]).
|
22
22
|
.TP 12n
|
23
23
|
.B \-\-width \f[I]WIDTH\f[]
|
24
24
|
Specify a column width to which to wrap the output. For no wrapping, use
|
@@ -45,6 +45,14 @@ be rendered as curly quotes, depending on their position.
|
|
45
45
|
\f[C]\-\-\-\f[] will be rendered as an em-dash.
|
46
46
|
\f[C]...\f[] will be rendered as ellipses.
|
47
47
|
.TP 12n
|
48
|
+
.B \-\-safe
|
49
|
+
Do not render raw HTML or potentially dangerous URLs.
|
50
|
+
(Raw HTML is replaced by a placeholder comment; potentially
|
51
|
+
dangerous URLs are replaced by empty strings.) Dangerous
|
52
|
+
URLs are those that begin with `javascript:`, `vbscript:`,
|
53
|
+
`file:`, or `data:` (except for `image/png`, `image/gif`,
|
54
|
+
`image/jpeg`, or `image/webp` mime types).
|
55
|
+
.TP 12n
|
48
56
|
.B \-\-help
|
49
57
|
Print usage information.
|
50
58
|
.TP 12n
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.TH cmark 3 "
|
1
|
+
.TH cmark 3 "July 13, 2015" "LOCAL" "Library Functions Manual"
|
2
2
|
.SH
|
3
3
|
NAME
|
4
4
|
.PP
|
@@ -14,8 +14,8 @@ Simple Interface
|
|
14
14
|
|
15
15
|
.PP
|
16
16
|
Convert \f[I]text\f[] (assumed to be a UTF\-8 encoded string with length
|
17
|
-
\f[I]len\f[] from CommonMark Markdown to HTML, returning a
|
18
|
-
UTF\-8\-encoded string.
|
17
|
+
\f[I]len\f[] from CommonMark Markdown to HTML, returning a
|
18
|
+
null\-terminated, UTF\-8\-encoded string.
|
19
19
|
|
20
20
|
.SS
|
21
21
|
Node Structure
|
@@ -27,9 +27,9 @@ Creating and Destroying Nodes
|
|
27
27
|
\fIcmark_node*\f[] \fBcmark_node_new\f[](\fIcmark_node_type type\f[])
|
28
28
|
|
29
29
|
.PP
|
30
|
-
Creates a new node of type \f[I]type\f[]
|
31
|
-
other required properties, which it is the caller's responsibility
|
32
|
-
|
30
|
+
Creates a new node of type \f[I]type\f[]. Note that the node may have
|
31
|
+
other required properties, which it is the caller's responsibility to
|
32
|
+
assign.
|
33
33
|
|
34
34
|
.PP
|
35
35
|
\fIvoid\f[] \fBcmark_node_free\f[](\fIcmark_node *node\f[])
|
@@ -51,8 +51,8 @@ there is none.
|
|
51
51
|
\fIcmark_node*\f[] \fBcmark_node_previous\f[](\fIcmark_node *node\f[])
|
52
52
|
|
53
53
|
.PP
|
54
|
-
Returns the previous node in the sequence after \f[I]node\f[], or NULL
|
55
|
-
there is none.
|
54
|
+
Returns the previous node in the sequence after \f[I]node\f[], or NULL
|
55
|
+
if there is none.
|
56
56
|
|
57
57
|
.PP
|
58
58
|
\fIcmark_node*\f[] \fBcmark_node_parent\f[](\fIcmark_node *node\f[])
|
@@ -64,29 +64,31 @@ Returns the parent of \f[I]node\f[], or NULL if there is none.
|
|
64
64
|
\fIcmark_node*\f[] \fBcmark_node_first_child\f[](\fIcmark_node *node\f[])
|
65
65
|
|
66
66
|
.PP
|
67
|
-
Returns the first child of \f[I]node\f[], or NULL if \f[I]node\f[] has
|
67
|
+
Returns the first child of \f[I]node\f[], or NULL if \f[I]node\f[] has
|
68
|
+
no children.
|
68
69
|
|
69
70
|
.PP
|
70
71
|
\fIcmark_node*\f[] \fBcmark_node_last_child\f[](\fIcmark_node *node\f[])
|
71
72
|
|
72
73
|
.PP
|
73
|
-
Returns the last child of \f[I]node\f[], or NULL if \f[I]node\f[] has no
|
74
|
+
Returns the last child of \f[I]node\f[], or NULL if \f[I]node\f[] has no
|
75
|
+
children.
|
74
76
|
|
75
77
|
.SS
|
76
78
|
Iterator
|
77
79
|
.PP
|
78
80
|
An iterator will walk through a tree of nodes, starting from a root
|
79
81
|
node, returning one node at a time, together with information about
|
80
|
-
whether the node is being entered or exited.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
outputs an open tag and an \f[C]EXIT\f[] event outputs a close tag.
|
88
|
-
|
89
|
-
|
82
|
+
whether the node is being entered or exited. The iterator will first
|
83
|
+
descend to a child node, if there is one. When there is no child, the
|
84
|
+
iterator will go to the next sibling. When there is no next sibling, the
|
85
|
+
iterator will return to the parent (but with a \f[I]cmark_event_type\f[]
|
86
|
+
of \f[C]CMARK_EVENT_EXIT\f[]). The iterator will return
|
87
|
+
\f[C]CMARK_EVENT_DONE\f[] when it reaches the root node again. One
|
88
|
+
natural application is an HTML renderer, where an \f[C]ENTER\f[] event
|
89
|
+
outputs an open tag and an \f[C]EXIT\f[] event outputs a close tag. An
|
90
|
+
iterator might also be used to transform an AST in some systematic way,
|
91
|
+
for example, turning all level\-3 headers into regular paragraphs.
|
90
92
|
.IP
|
91
93
|
.nf
|
92
94
|
\f[C]
|
@@ -105,8 +107,8 @@ usage_example(cmark_node *root) {
|
|
105
107
|
\f[]
|
106
108
|
.fi
|
107
109
|
.PP
|
108
|
-
Iterators will never return \f[C]EXIT\f[] events for leaf nodes, which
|
109
|
-
of type:
|
110
|
+
Iterators will never return \f[C]EXIT\f[] events for leaf nodes, which
|
111
|
+
are nodes of type:
|
110
112
|
.IP \[bu] 2
|
111
113
|
CMARK_NODE_HTML
|
112
114
|
.IP \[bu] 2
|
@@ -124,15 +126,16 @@ CMARK_NODE_CODE
|
|
124
126
|
.IP \[bu] 2
|
125
127
|
CMARK_NODE_INLINE_HTML
|
126
128
|
.PP
|
127
|
-
Nodes must only be modified after an \f[C]EXIT\f[] event, or an
|
128
|
-
leaf nodes.
|
129
|
+
Nodes must only be modified after an \f[C]EXIT\f[] event, or an
|
130
|
+
\f[C]ENTER\f[] event for leaf nodes.
|
129
131
|
|
130
132
|
.PP
|
131
133
|
\fIcmark_iter*\f[] \fBcmark_iter_new\f[](\fIcmark_node *root\f[])
|
132
134
|
|
133
135
|
.PP
|
134
|
-
Creates a new iterator starting at \f[I]root\f[]
|
135
|
-
type are undefined until \f[C]cmark_iter_next\f[] is called for
|
136
|
+
Creates a new iterator starting at \f[I]root\f[]. The current node and
|
137
|
+
event type are undefined until \f[C]cmark_iter_next\f[] is called for
|
138
|
+
the first time.
|
136
139
|
|
137
140
|
.PP
|
138
141
|
\fIvoid\f[] \fBcmark_iter_free\f[](\fIcmark_iter *iter\f[])
|
@@ -144,8 +147,9 @@ Frees the memory allocated for an iterator.
|
|
144
147
|
\fIcmark_event_type\f[] \fBcmark_iter_next\f[](\fIcmark_iter *iter\f[])
|
145
148
|
|
146
149
|
.PP
|
147
|
-
Advances to the next node and returns the event type
|
148
|
-
\f[C]
|
150
|
+
Advances to the next node and returns the event type
|
151
|
+
(\f[C]CMARK_EVENT_ENTER\f[], \f[C]CMARK_EVENT_EXIT\f[] or
|
152
|
+
\f[C]CMARK_EVENT_DONE\f[]).
|
149
153
|
|
150
154
|
.PP
|
151
155
|
\fIcmark_node*\f[] \fBcmark_iter_get_node\f[](\fIcmark_iter *iter\f[])
|
@@ -169,8 +173,8 @@ Returns the root node.
|
|
169
173
|
\fIvoid\f[] \fBcmark_iter_reset\f[](\fIcmark_iter *iter\f[], \fIcmark_node *current\f[], \fIcmark_event_type event_type\f[])
|
170
174
|
|
171
175
|
.PP
|
172
|
-
Resets the iterator so that the current node is \f[I]current\f[] and
|
173
|
-
|
176
|
+
Resets the iterator so that the current node is \f[I]current\f[] and the
|
177
|
+
event type is \f[I]event_type\f[]. The new current node must be a
|
174
178
|
descendant of the root node or the root node itself.
|
175
179
|
|
176
180
|
.SS
|
@@ -180,14 +184,14 @@ Accessors
|
|
180
184
|
\fIvoid*\f[] \fBcmark_node_get_user_data\f[](\fIcmark_node *node\f[])
|
181
185
|
|
182
186
|
.PP
|
183
|
-
Returns the user data of \f[I]node\f[]
|
187
|
+
Returns the user data of \f[I]node\f[].
|
184
188
|
|
185
189
|
.PP
|
186
190
|
\fIint\f[] \fBcmark_node_set_user_data\f[](\fIcmark_node *node\f[], \fIvoid *user_data\f[])
|
187
191
|
|
188
192
|
.PP
|
189
|
-
Sets arbitrary user data for \f[I]node\f[]
|
190
|
-
|
193
|
+
Sets arbitrary user data for \f[I]node\f[]. Returns 1 on success, 0 on
|
194
|
+
failure.
|
191
195
|
|
192
196
|
.PP
|
193
197
|
\fIcmark_node_type\f[] \fBcmark_node_get_type\f[](\fIcmark_node *node\f[])
|
@@ -200,7 +204,7 @@ Returns the type of \f[I]node\f[], or \f[C]CMARK_NODE_NONE\f[] on error.
|
|
200
204
|
|
201
205
|
.PP
|
202
206
|
Like \f[I]cmark_node_get_type\f[], but returns a string representation
|
203
|
-
of the type, or \f[C]"<unknown>"\f[]
|
207
|
+
of the type, or \f[C]"<unknown>"\f[].
|
204
208
|
|
205
209
|
.PP
|
206
210
|
\fIconst char*\f[] \fBcmark_node_get_literal\f[](\fIcmark_node *node\f[])
|
@@ -212,60 +216,64 @@ Returns the string contents of \f[I]node\f[], or NULL if none.
|
|
212
216
|
\fIint\f[] \fBcmark_node_set_literal\f[](\fIcmark_node *node\f[], \fIconst char *content\f[])
|
213
217
|
|
214
218
|
.PP
|
215
|
-
Sets the string contents of \f[I]node\f[]
|
216
|
-
|
219
|
+
Sets the string contents of \f[I]node\f[]. Returns 1 on success, 0 on
|
220
|
+
failure.
|
217
221
|
|
218
222
|
.PP
|
219
223
|
\fIint\f[] \fBcmark_node_get_header_level\f[](\fIcmark_node *node\f[])
|
220
224
|
|
221
225
|
.PP
|
222
|
-
Returns the header level of \f[I]node\f[], or 0 if \f[I]node\f[] is not
|
226
|
+
Returns the header level of \f[I]node\f[], or 0 if \f[I]node\f[] is not
|
227
|
+
a header.
|
223
228
|
|
224
229
|
.PP
|
225
230
|
\fIint\f[] \fBcmark_node_set_header_level\f[](\fIcmark_node *node\f[], \fIint level\f[])
|
226
231
|
|
227
232
|
.PP
|
228
|
-
Sets the header level of \f[I]node\f[], returning 1 on success and 0 on
|
233
|
+
Sets the header level of \f[I]node\f[], returning 1 on success and 0 on
|
234
|
+
error.
|
229
235
|
|
230
236
|
.PP
|
231
237
|
\fIcmark_list_type\f[] \fBcmark_node_get_list_type\f[](\fIcmark_node *node\f[])
|
232
238
|
|
233
239
|
.PP
|
234
|
-
Returns the list type of \f[I]node\f[], or \f[C]CMARK_NO_LIST\f[] if
|
235
|
-
is not a list.
|
240
|
+
Returns the list type of \f[I]node\f[], or \f[C]CMARK_NO_LIST\f[] if
|
241
|
+
\f[I]node\f[] is not a list.
|
236
242
|
|
237
243
|
.PP
|
238
244
|
\fIint\f[] \fBcmark_node_set_list_type\f[](\fIcmark_node *node\f[], \fIcmark_list_type type\f[])
|
239
245
|
|
240
246
|
.PP
|
241
|
-
Sets the list type of \f[I]node\f[], returning 1 on success and 0 on
|
247
|
+
Sets the list type of \f[I]node\f[], returning 1 on success and 0 on
|
248
|
+
error.
|
242
249
|
|
243
250
|
.PP
|
244
251
|
\fIcmark_delim_type\f[] \fBcmark_node_get_list_delim\f[](\fIcmark_node *node\f[])
|
245
252
|
|
246
253
|
.PP
|
247
|
-
Returns the list delimiter type of \f[I]node\f[], or
|
248
|
-
is not a list.
|
254
|
+
Returns the list delimiter type of \f[I]node\f[], or
|
255
|
+
\f[C]CMARK_NO_DELIM\f[] if \f[I]node\f[] is not a list.
|
249
256
|
|
250
257
|
.PP
|
251
258
|
\fIint\f[] \fBcmark_node_set_list_delim\f[](\fIcmark_node *node\f[], \fIcmark_delim_type delim\f[])
|
252
259
|
|
253
260
|
.PP
|
254
|
-
Sets the list delimiter type of \f[I]node\f[], returning 1 on success
|
255
|
-
on error.
|
261
|
+
Sets the list delimiter type of \f[I]node\f[], returning 1 on success
|
262
|
+
and 0 on error.
|
256
263
|
|
257
264
|
.PP
|
258
265
|
\fIint\f[] \fBcmark_node_get_list_start\f[](\fIcmark_node *node\f[])
|
259
266
|
|
260
267
|
.PP
|
261
|
-
Returns starting number of \f[I]node\f[], if it is an ordered list,
|
268
|
+
Returns starting number of \f[I]node\f[], if it is an ordered list,
|
269
|
+
otherwise 0.
|
262
270
|
|
263
271
|
.PP
|
264
272
|
\fIint\f[] \fBcmark_node_set_list_start\f[](\fIcmark_node *node\f[], \fIint start\f[])
|
265
273
|
|
266
274
|
.PP
|
267
|
-
Sets starting number of \f[I]node\f[], if it is an ordered list. Returns
|
268
|
-
on success, 0 on failure.
|
275
|
+
Sets starting number of \f[I]node\f[], if it is an ordered list. Returns
|
276
|
+
1 on success, 0 on failure.
|
269
277
|
|
270
278
|
.PP
|
271
279
|
\fIint\f[] \fBcmark_node_get_list_tight\f[](\fIcmark_node *node\f[])
|
@@ -277,7 +285,7 @@ Returns 1 if \f[I]node\f[] is a tight list, 0 otherwise.
|
|
277
285
|
\fIint\f[] \fBcmark_node_set_list_tight\f[](\fIcmark_node *node\f[], \fIint tight\f[])
|
278
286
|
|
279
287
|
.PP
|
280
|
-
Sets the "tightness" of a list.
|
288
|
+
Sets the "tightness" of a list. Returns 1 on success, 0 on failure.
|
281
289
|
|
282
290
|
.PP
|
283
291
|
\fIconst char*\f[] \fBcmark_node_get_fence_info\f[](\fIcmark_node *node\f[])
|
@@ -289,8 +297,8 @@ Returns the info string from a fenced code block, or NULL if none.
|
|
289
297
|
\fIint\f[] \fBcmark_node_set_fence_info\f[](\fIcmark_node *node\f[], \fIconst char *info\f[])
|
290
298
|
|
291
299
|
.PP
|
292
|
-
Sets the info string in a fenced code block, returning 1 on
|
293
|
-
|
300
|
+
Sets the info string in a fenced code block, returning 1 on success and
|
301
|
+
0 on failure.
|
294
302
|
|
295
303
|
.PP
|
296
304
|
\fIconst char*\f[] \fBcmark_node_get_url\f[](\fIcmark_node *node\f[])
|
@@ -302,8 +310,8 @@ Gets the URL of a link or image \f[I]node\f[], or NULL if none.
|
|
302
310
|
\fIint\f[] \fBcmark_node_set_url\f[](\fIcmark_node *node\f[], \fIconst char *url\f[])
|
303
311
|
|
304
312
|
.PP
|
305
|
-
Sets the URL of a link or image \f[I]node\f[]
|
306
|
-
|
313
|
+
Sets the URL of a link or image \f[I]node\f[]. Returns 1 on success, 0
|
314
|
+
on failure.
|
307
315
|
|
308
316
|
.PP
|
309
317
|
\fIconst char*\f[] \fBcmark_node_get_title\f[](\fIcmark_node *node\f[])
|
@@ -315,8 +323,8 @@ Gets the title of a link or image \f[I]node\f[], or NULL if none.
|
|
315
323
|
\fIint\f[] \fBcmark_node_set_title\f[](\fIcmark_node *node\f[], \fIconst char *title\f[])
|
316
324
|
|
317
325
|
.PP
|
318
|
-
Sets the title of a link or image \f[I]node\f[]
|
319
|
-
|
326
|
+
Sets the title of a link or image \f[I]node\f[]. Returns 1 on success, 0
|
327
|
+
on failure.
|
320
328
|
|
321
329
|
.PP
|
322
330
|
\fIint\f[] \fBcmark_node_get_start_line\f[](\fIcmark_node *node\f[])
|
@@ -350,33 +358,35 @@ Tree Manipulation
|
|
350
358
|
|
351
359
|
.PP
|
352
360
|
Unlinks a \f[I]node\f[], removing it from the tree, but not freeing its
|
353
|
-
memory.
|
361
|
+
memory. (Use \f[I]cmark_node_free\f[] for that.)
|
354
362
|
|
355
363
|
.PP
|
356
364
|
\fIint\f[] \fBcmark_node_insert_before\f[](\fIcmark_node *node\f[], \fIcmark_node *sibling\f[])
|
357
365
|
|
358
366
|
.PP
|
359
|
-
Inserts \f[I]sibling\f[] before \f[I]node\f[]
|
367
|
+
Inserts \f[I]sibling\f[] before \f[I]node\f[]. Returns 1 on success, 0
|
368
|
+
on failure.
|
360
369
|
|
361
370
|
.PP
|
362
371
|
\fIint\f[] \fBcmark_node_insert_after\f[](\fIcmark_node *node\f[], \fIcmark_node *sibling\f[])
|
363
372
|
|
364
373
|
.PP
|
365
|
-
Inserts \f[I]sibling\f[] after \f[I]node\f[]
|
374
|
+
Inserts \f[I]sibling\f[] after \f[I]node\f[]. Returns 1 on success, 0 on
|
375
|
+
failure.
|
366
376
|
|
367
377
|
.PP
|
368
378
|
\fIint\f[] \fBcmark_node_prepend_child\f[](\fIcmark_node *node\f[], \fIcmark_node *child\f[])
|
369
379
|
|
370
380
|
.PP
|
371
|
-
Adds \f[I]child\f[] to the beginning of the children of \f[I]node\f[]
|
381
|
+
Adds \f[I]child\f[] to the beginning of the children of \f[I]node\f[].
|
372
382
|
Returns 1 on success, 0 on failure.
|
373
383
|
|
374
384
|
.PP
|
375
385
|
\fIint\f[] \fBcmark_node_append_child\f[](\fIcmark_node *node\f[], \fIcmark_node *child\f[])
|
376
386
|
|
377
387
|
.PP
|
378
|
-
Adds \f[I]child\f[] to the end of the children of \f[I]node\f[]
|
379
|
-
|
388
|
+
Adds \f[I]child\f[] to the end of the children of \f[I]node\f[]. Returns
|
389
|
+
1 on success, 0 on failure.
|
380
390
|
|
381
391
|
.PP
|
382
392
|
\fIvoid\f[] \fBcmark_consolidate_text_nodes\f[](\fIcmark_node *root\f[])
|
@@ -429,7 +439,7 @@ Frees memory allocated for a parser object.
|
|
429
439
|
\fIvoid\f[] \fBcmark_parser_feed\f[](\fIcmark_parser *parser\f[], \fIconst char *buffer\f[], \fIsize_t len\f[])
|
430
440
|
|
431
441
|
.PP
|
432
|
-
Feeds a string of length \f[I]len\f[] to \f[I]parser\f[]
|
442
|
+
Feeds a string of length \f[I]len\f[] to \f[I]parser\f[].
|
433
443
|
|
434
444
|
.PP
|
435
445
|
\fIcmark_node *\f[] \fBcmark_parser_finish\f[](\fIcmark_parser *parser\f[])
|
@@ -441,15 +451,15 @@ Finish parsing and return a pointer to a tree of nodes.
|
|
441
451
|
\fIcmark_node *\f[] \fBcmark_parse_document\f[](\fIconst char *buffer\f[], \fIsize_t len\f[], \fIint options\f[])
|
442
452
|
|
443
453
|
.PP
|
444
|
-
Parse a CommonMark document in \f[I]buffer\f[] of length \f[I]len\f[]
|
454
|
+
Parse a CommonMark document in \f[I]buffer\f[] of length \f[I]len\f[].
|
445
455
|
Returns a pointer to a tree of nodes.
|
446
456
|
|
447
457
|
.PP
|
448
458
|
\fIcmark_node *\f[] \fBcmark_parse_file\f[](\fIFILE *f\f[], \fIint options\f[])
|
449
459
|
|
450
460
|
.PP
|
451
|
-
Parse a CommonMark document in file \f[I]f\f[], returning a pointer to
|
452
|
-
|
461
|
+
Parse a CommonMark document in file \f[I]f\f[], returning a pointer to a
|
462
|
+
tree of nodes.
|
453
463
|
|
454
464
|
.SS
|
455
465
|
Rendering
|
@@ -464,11 +474,11 @@ Render a \f[I]node\f[] tree as XML.
|
|
464
474
|
\fIchar *\f[] \fBcmark_render_html\f[](\fIcmark_node *root\f[], \fIint options\f[])
|
465
475
|
|
466
476
|
.PP
|
467
|
-
Render a \f[I]node\f[] tree as an HTML fragment.
|
468
|
-
|
477
|
+
Render a \f[I]node\f[] tree as an HTML fragment. It is up to the user to
|
478
|
+
add an appropriate header and footer.
|
469
479
|
|
470
480
|
.PP
|
471
|
-
\fIchar *\f[] \fBcmark_render_man\f[](\fIcmark_node *root\f[], \fIint options\f[])
|
481
|
+
\fIchar *\f[] \fBcmark_render_man\f[](\fIcmark_node *root\f[], \fIint options\f[], \fIint width\f[])
|
472
482
|
|
473
483
|
.PP
|
474
484
|
Render a \f[I]node\f[] tree as a groff man page, without the header.
|
@@ -479,6 +489,12 @@ Render a \f[I]node\f[] tree as a groff man page, without the header.
|
|
479
489
|
.PP
|
480
490
|
Render a \f[I]node\f[] tree as a commonmark document.
|
481
491
|
|
492
|
+
.PP
|
493
|
+
\fIchar *\f[] \fBcmark_render_latex\f[](\fIcmark_node *root\f[], \fIint options\f[], \fIint width\f[])
|
494
|
+
|
495
|
+
.PP
|
496
|
+
Render a \f[I]node\f[] tree as a LaTeX document.
|
497
|
+
|
482
498
|
.PP
|
483
499
|
.nf
|
484
500
|
\fC
|
@@ -537,7 +553,8 @@ Normalize tree by consolidating adjacent text nodes.
|
|
537
553
|
.fi
|
538
554
|
|
539
555
|
.PP
|
540
|
-
Convert straight quotes to curly, \-\-\- to em dashes, \-\- to en
|
556
|
+
Convert straight quotes to curly, \-\-\- to em dashes, \-\- to en
|
557
|
+
dashes.
|
541
558
|
|
542
559
|
.PP
|
543
560
|
.nf
|
@@ -549,21 +566,31 @@ Convert straight quotes to curly, \-\-\- to em dashes, \-\- to en dashes.
|
|
549
566
|
.fi
|
550
567
|
|
551
568
|
.PP
|
552
|
-
Validate UTF\-8 in the input before parsing, replacing illegal
|
553
|
-
|
554
|
-
|
555
|
-
.SS
|
556
|
-
Version information
|
569
|
+
Validate UTF\-8 in the input before parsing, replacing illegal sequences
|
570
|
+
with the replacement character U+FFFD.
|
557
571
|
|
558
572
|
.PP
|
559
573
|
.nf
|
560
574
|
\fC
|
561
575
|
.RS 0n
|
562
|
-
|
576
|
+
#define CMARK_OPT_SAFE 32
|
563
577
|
.RE
|
564
578
|
\f[]
|
565
579
|
.fi
|
566
580
|
|
581
|
+
.PP
|
582
|
+
Suppress raw HTML and unsafe links (\f[C]javascript:\f[],
|
583
|
+
\f[C]vbscript:\f[], \f[C]file:\f[], and \f[C]data:\f[], except for
|
584
|
+
\f[C]image/png\f[], \f[C]image/gif\f[], \f[C]image/jpeg\f[], or
|
585
|
+
\f[C]image/webp\f[] mime types). Raw HTML is replaced by a placeholder
|
586
|
+
HTML comment. Unsafe links are replaced by empty strings.
|
587
|
+
|
588
|
+
.SS
|
589
|
+
Version information
|
590
|
+
|
591
|
+
.PP
|
592
|
+
\fIint\f[] \fBcmark_version\f[](\fI\f[])
|
593
|
+
|
567
594
|
.PP
|
568
595
|
The library version as integer for runtime checks. Also available as
|
569
596
|
macro CMARK_VERSION for compile time checks.
|
@@ -577,20 +604,14 @@ Bits 0\-7 contain the patchlevel.
|
|
577
604
|
In hexadecimal format, the number 0x010203 represents version 1.2.3.
|
578
605
|
|
579
606
|
.PP
|
580
|
-
|
581
|
-
\fC
|
582
|
-
.RS 0n
|
583
|
-
extern const char cmark_version_string[];
|
584
|
-
.RE
|
585
|
-
\f[]
|
586
|
-
.fi
|
607
|
+
\fIconst char *\f[] \fBcmark_version_string\f[](\fI\f[])
|
587
608
|
|
588
609
|
.PP
|
589
|
-
The library version string for runtime checks. Also available as
|
590
|
-
|
610
|
+
The library version string for runtime checks. Also available as macro
|
611
|
+
CMARK_VERSION_STRING for compile time checks.
|
591
612
|
|
592
613
|
.SH
|
593
614
|
AUTHORS
|
594
615
|
.PP
|
595
|
-
John MacFarlane, Vicent Marti,
|
616
|
+
John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
|
596
617
|
|