commonmarker 0.15.0 → 0.16.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 +1 -1
- data/ext/commonmarker/cmark/CMakeLists.txt +2 -1
- data/ext/commonmarker/cmark/Makefile +2 -2
- data/ext/commonmarker/cmark/api_test/main.c +45 -0
- data/ext/commonmarker/cmark/build/CMakeCache.txt +473 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCCompiler.cmake +68 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeCXXCompiler.cmake +70 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CMakeSystem.cmake +15 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/CMakeCCompilerId.c +567 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdC/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +539 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/3.8.0/CompilerIdCXX/a.out +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +14 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +637 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +156 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +390 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +48 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +34 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +405 -0
- data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/CTestTestfile.cmake +11 -0
- data/ext/commonmarker/cmark/build/Makefile +280 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +35 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +168 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +17 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +5 -0
- data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/api_test/Makefile +302 -0
- data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/cmake_install.cmake +49 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +36 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +253 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +16 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +8 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +220 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +249 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +15 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +100 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +100 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +8 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
- data/ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/extensions/Makefile +426 -0
- data/ext/commonmarker/cmark/build/extensions/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/build/extensions/cmarkextensions_export.h +42 -0
- data/ext/commonmarker/cmark/build/extensions/libcmark-gfmextensions.a +0 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/man/Makefile +196 -0
- data/ext/commonmarker/cmark/build/man/cmake_install.cmake +37 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark-release.cmake +38 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +95 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +30 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/build.make +115 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/progress.make +3 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +58 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/build.make +765 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +35 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +1 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +622 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +52 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +762 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +34 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +3 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +310 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +310 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +10 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +2 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +27 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
- data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/src/Makefile +1099 -0
- data/ext/commonmarker/cmark/build/src/cmake_install.cmake +100 -0
- data/ext/commonmarker/cmark/build/src/cmark_export.h +42 -0
- data/ext/commonmarker/cmark/build/src/cmark_version.h +7 -0
- data/ext/commonmarker/cmark/build/src/config.h +76 -0
- data/ext/commonmarker/cmark/build/src/libcmark-gfm.a +0 -0
- data/ext/commonmarker/cmark/build/src/libcmark-gfm.pc +10 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +1 -0
- data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +17 -0
- data/ext/commonmarker/cmark/build/testdir/Makefile +196 -0
- data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +29 -0
- data/ext/commonmarker/cmark/changelog.txt +7 -0
- data/ext/commonmarker/cmark/extensions/CMakeLists.txt +1 -1
- data/ext/commonmarker/cmark/extensions/table.c +1 -0
- data/ext/commonmarker/cmark/man/man3/cmark-gfm.3 +1 -13
- data/ext/commonmarker/cmark/src/CMakeLists.txt +2 -1
- data/ext/commonmarker/cmark/src/blocks.c +1 -3
- data/ext/commonmarker/cmark/src/cmark.h +16 -4
- data/ext/commonmarker/cmark/src/cmark_extension_api.h +6 -0
- data/ext/commonmarker/cmark/src/cmark_version.h.in +2 -2
- data/ext/commonmarker/cmark/src/inlines.c +11 -2
- data/ext/commonmarker/cmark/src/main.c +9 -4
- data/ext/commonmarker/cmark/src/plaintext.c +212 -0
- data/ext/commonmarker/cmark/src/scanners.c +10919 -7141
- data/ext/commonmarker/cmark/src/scanners.h +2 -0
- data/ext/commonmarker/cmark/src/scanners.re +11 -0
- data/ext/commonmarker/cmark/src/syntax_extension.c +5 -0
- data/ext/commonmarker/cmark/src/syntax_extension.h +1 -0
- data/ext/commonmarker/commonmarker.c +20 -0
- data/lib/commonmarker/config.rb +1 -1
- data/lib/commonmarker/node.rb +10 -0
- data/lib/commonmarker/version.rb +1 -1
- data/test/test_node.rb +5 -5
- data/test/test_plaintext.rb +44 -0
- metadata +138 -2
@@ -0,0 +1,29 @@
|
|
1
|
+
# Install script for directory: /Users/kivikakk/Code/gjtorikian/commonmarker/ext/commonmarker/cmark/test
|
2
|
+
|
3
|
+
# Set the install prefix
|
4
|
+
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
5
|
+
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
6
|
+
endif()
|
7
|
+
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
8
|
+
|
9
|
+
# Set the install configuration name.
|
10
|
+
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
11
|
+
if(BUILD_TYPE)
|
12
|
+
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
13
|
+
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
14
|
+
else()
|
15
|
+
set(CMAKE_INSTALL_CONFIG_NAME "Release")
|
16
|
+
endif()
|
17
|
+
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
18
|
+
endif()
|
19
|
+
|
20
|
+
# Set the component getting installed.
|
21
|
+
if(NOT CMAKE_INSTALL_COMPONENT)
|
22
|
+
if(COMPONENT)
|
23
|
+
message(STATUS "Install component: \"${COMPONENT}\"")
|
24
|
+
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
25
|
+
else()
|
26
|
+
set(CMAKE_INSTALL_COMPONENT)
|
27
|
+
endif()
|
28
|
+
endif()
|
29
|
+
|
@@ -1,3 +1,10 @@
|
|
1
|
+
[0.27.1.gfm.0]
|
2
|
+
|
3
|
+
* Add extensions: tagfilter, strikethrough, table, autolink.
|
4
|
+
* Add arena memory implementation.
|
5
|
+
* Add CMARK_OPT_GITHUB_PRE_LANG for fenced code blocks.
|
6
|
+
* Skip UTF-8 BOM on input.
|
7
|
+
|
1
8
|
[0.27.1]
|
2
9
|
|
3
10
|
* Set policy for CMP0063 to avoid a warning (#162).
|
@@ -39,7 +39,7 @@ if (CMARK_SHARED)
|
|
39
39
|
|
40
40
|
set_target_properties(${LIBRARY} PROPERTIES
|
41
41
|
OUTPUT_NAME "cmark-gfmextensions"
|
42
|
-
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
42
|
+
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM}
|
43
43
|
VERSION ${PROJECT_VERSION})
|
44
44
|
|
45
45
|
set_property(TARGET ${LIBRARY}
|
@@ -632,6 +632,7 @@ cmark_syntax_extension *create_table_extension(void) {
|
|
632
632
|
cmark_syntax_extension_set_can_contain_func(self, can_contain);
|
633
633
|
cmark_syntax_extension_set_contains_inlines_func(self, contains_inlines);
|
634
634
|
cmark_syntax_extension_set_commonmark_render_func(self, commonmark_render);
|
635
|
+
cmark_syntax_extension_set_plaintext_render_func(self, commonmark_render);
|
635
636
|
cmark_syntax_extension_set_latex_render_func(self, latex_render);
|
636
637
|
cmark_syntax_extension_set_man_render_func(self, man_render);
|
637
638
|
cmark_syntax_extension_set_html_render_func(self, html_render);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.TH cmark-gfm 3 "
|
1
|
+
.TH cmark-gfm 3 "May 05, 2017" "LOCAL" "Library Functions Manual"
|
2
2
|
.SH
|
3
3
|
NAME
|
4
4
|
.PP
|
@@ -862,18 +862,6 @@ Render \f[C]softbreak\f[] elements as spaces.
|
|
862
862
|
.SS
|
863
863
|
Options affecting parsing
|
864
864
|
|
865
|
-
.PP
|
866
|
-
.nf
|
867
|
-
\fC
|
868
|
-
.RS 0n
|
869
|
-
#define CMARK_OPT_NORMALIZE (1 << 8)
|
870
|
-
.RE
|
871
|
-
\f[]
|
872
|
-
.fi
|
873
|
-
|
874
|
-
.PP
|
875
|
-
Normalize tree by consolidating adjacent text nodes.
|
876
|
-
|
877
865
|
.PP
|
878
866
|
.nf
|
879
867
|
\fC
|
@@ -39,6 +39,7 @@ set(LIBRARY_SOURCES
|
|
39
39
|
xml.c
|
40
40
|
html.c
|
41
41
|
commonmark.c
|
42
|
+
plaintext.c
|
42
43
|
latex.c
|
43
44
|
houdini_href_e.c
|
44
45
|
houdini_html_e.c
|
@@ -100,7 +101,7 @@ if (CMARK_SHARED)
|
|
100
101
|
# Include minor version and patch level in soname for now.
|
101
102
|
set_target_properties(${LIBRARY} PROPERTIES
|
102
103
|
OUTPUT_NAME "cmark-gfm"
|
103
|
-
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
104
|
+
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM}
|
104
105
|
VERSION ${PROJECT_VERSION})
|
105
106
|
|
106
107
|
set_property(TARGET ${LIBRARY}
|
@@ -1310,9 +1310,7 @@ cmark_node *cmark_parser_finish(cmark_parser *parser) {
|
|
1310
1310
|
|
1311
1311
|
finalize_document(parser);
|
1312
1312
|
|
1313
|
-
|
1314
|
-
cmark_consolidate_text_nodes(parser->root);
|
1315
|
-
}
|
1313
|
+
cmark_consolidate_text_nodes(parser->root);
|
1316
1314
|
|
1317
1315
|
cmark_strbuf_free(&parser->curline);
|
1318
1316
|
cmark_strbuf_free(&parser->linebuf);
|
@@ -630,6 +630,18 @@ char *cmark_render_commonmark(cmark_node *root, int options, int width);
|
|
630
630
|
CMARK_EXPORT
|
631
631
|
char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
632
632
|
|
633
|
+
/** Render a 'node' tree as a plain text document.
|
634
|
+
* It is the caller's responsibility to free the returned buffer.
|
635
|
+
*/
|
636
|
+
CMARK_EXPORT
|
637
|
+
char *cmark_render_plaintext(cmark_node *root, int options, int width);
|
638
|
+
|
639
|
+
/** As for 'cmark_render_plaintext', but specifying the allocator to use for
|
640
|
+
* the resulting string.
|
641
|
+
*/
|
642
|
+
CMARK_EXPORT
|
643
|
+
char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
644
|
+
|
633
645
|
/** Render a 'node' tree as a LaTeX document.
|
634
646
|
* It is the caller's responsibility to free the returned buffer.
|
635
647
|
*/
|
@@ -678,10 +690,6 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
|
|
678
690
|
* ### Options affecting parsing
|
679
691
|
*/
|
680
692
|
|
681
|
-
/** Normalize tree by consolidating adjacent text nodes.
|
682
|
-
*/
|
683
|
-
#define CMARK_OPT_NORMALIZE (1 << 8)
|
684
|
-
|
685
693
|
/** Validate UTF-8 in the input before parsing, replacing illegal
|
686
694
|
* sequences with the replacement character U+FFFD.
|
687
695
|
*/
|
@@ -696,6 +704,10 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
|
|
696
704
|
*/
|
697
705
|
#define CMARK_OPT_GITHUB_PRE_LANG (1 << 11)
|
698
706
|
|
707
|
+
/** Be liberal in interpreting inline HTML tags.
|
708
|
+
*/
|
709
|
+
#define CMARK_OPT_LIBERAL_HTML_TAG (1 << 12)
|
710
|
+
|
699
711
|
/**
|
700
712
|
* ## Version information
|
701
713
|
*/
|
@@ -323,6 +323,12 @@ CMARK_EXPORT
|
|
323
323
|
void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *extension,
|
324
324
|
cmark_common_render_func func);
|
325
325
|
|
326
|
+
/** See the documentation for 'cmark_syntax_extension'
|
327
|
+
*/
|
328
|
+
CMARK_EXPORT
|
329
|
+
void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension,
|
330
|
+
cmark_common_render_func func);
|
331
|
+
|
326
332
|
/** See the documentation for 'cmark_syntax_extension'
|
327
333
|
*/
|
328
334
|
CMARK_EXPORT
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#ifndef CMARK_VERSION_H
|
2
2
|
#define CMARK_VERSION_H
|
3
3
|
|
4
|
-
#define CMARK_VERSION ((@PROJECT_VERSION_MAJOR@ <<
|
5
|
-
#define CMARK_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
|
4
|
+
#define CMARK_VERSION ((@PROJECT_VERSION_MAJOR@ << 24) | (@PROJECT_VERSION_MINOR@ << 16) | (@PROJECT_VERSION_PATCH@ << 8) | @PROJECT_VERSION_GFM@)
|
5
|
+
#define CMARK_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.gfm.@PROJECT_VERSION_GFM@"
|
6
6
|
|
7
7
|
#endif
|
@@ -754,7 +754,7 @@ cmark_chunk cmark_clean_title(cmark_mem *mem, cmark_chunk *title) {
|
|
754
754
|
|
755
755
|
// Parse an autolink or HTML tag.
|
756
756
|
// Assumes the subject has a '<' character at the current position.
|
757
|
-
static cmark_node *handle_pointy_brace(subject *subj) {
|
757
|
+
static cmark_node *handle_pointy_brace(subject *subj, bool liberal_html_tag) {
|
758
758
|
bufsize_t matchlen = 0;
|
759
759
|
cmark_chunk contents;
|
760
760
|
|
@@ -786,6 +786,15 @@ static cmark_node *handle_pointy_brace(subject *subj) {
|
|
786
786
|
return make_raw_html(subj->mem, contents);
|
787
787
|
}
|
788
788
|
|
789
|
+
if (liberal_html_tag) {
|
790
|
+
matchlen = scan_liberal_html_tag(&subj->input, subj->pos);
|
791
|
+
if (matchlen > 0) {
|
792
|
+
contents = cmark_chunk_dup(&subj->input, subj->pos - 1, matchlen + 1);
|
793
|
+
subj->pos += matchlen;
|
794
|
+
return make_raw_html(subj->mem, contents);
|
795
|
+
}
|
796
|
+
}
|
797
|
+
|
789
798
|
// if nothing matches, just return the opening <:
|
790
799
|
return make_str(subj->mem, cmark_chunk_literal("<"));
|
791
800
|
}
|
@@ -1139,7 +1148,7 @@ static int parse_inline(cmark_parser *parser, subject *subj, cmark_node *parent,
|
|
1139
1148
|
new_inl = handle_entity(subj);
|
1140
1149
|
break;
|
1141
1150
|
case '<':
|
1142
|
-
new_inl = handle_pointy_brace(subj);
|
1151
|
+
new_inl = handle_pointy_brace(subj, (options & CMARK_OPT_LIBERAL_HTML_TAG) != 0);
|
1143
1152
|
break;
|
1144
1153
|
case '*':
|
1145
1154
|
case '_':
|
@@ -24,6 +24,7 @@ typedef enum {
|
|
24
24
|
FORMAT_XML,
|
25
25
|
FORMAT_MAN,
|
26
26
|
FORMAT_COMMONMARK,
|
27
|
+
FORMAT_PLAINTEXT,
|
27
28
|
FORMAT_LATEX
|
28
29
|
} writer_format;
|
29
30
|
|
@@ -31,7 +32,7 @@ void print_usage() {
|
|
31
32
|
printf("Usage: cmark-gfm [FILE*]\n");
|
32
33
|
printf("Options:\n");
|
33
34
|
printf(" --to, -t FORMAT Specify output format (html, xml, man, "
|
34
|
-
"commonmark, latex)\n");
|
35
|
+
"commonmark, plaintext, latex)\n");
|
35
36
|
printf(" --width WIDTH Specify wrap width (default 0 = nowrap)\n");
|
36
37
|
printf(" --sourcepos Include source position attribute\n");
|
37
38
|
printf(" --hardbreaks Treat newlines as hard line breaks\n");
|
@@ -39,7 +40,6 @@ void print_usage() {
|
|
39
40
|
printf(" --safe Suppress raw HTML and dangerous URLs\n");
|
40
41
|
printf(" --smart Use smart punctuation\n");
|
41
42
|
printf(" --github-pre-lang Use GitHub-style <pre lang> for code blocks\n");
|
42
|
-
printf(" --normalize Consolidate adjacent text nodes\n");
|
43
43
|
printf(" --extension, -e EXTENSION_NAME Specify an extension name to use\n");
|
44
44
|
printf(" --list-extensions List available extensions and quit\n");
|
45
45
|
printf(" --help, -h Print usage information\n");
|
@@ -65,6 +65,9 @@ static bool print_document(cmark_node *document, writer_format writer,
|
|
65
65
|
case FORMAT_COMMONMARK:
|
66
66
|
result = cmark_render_commonmark_with_mem(document, options, width, mem);
|
67
67
|
break;
|
68
|
+
case FORMAT_PLAINTEXT:
|
69
|
+
result = cmark_render_plaintext_with_mem(document, options, width, mem);
|
70
|
+
break;
|
68
71
|
case FORMAT_LATEX:
|
69
72
|
result = cmark_render_latex_with_mem(document, options, width, mem);
|
70
73
|
break;
|
@@ -136,10 +139,10 @@ int main(int argc, char *argv[]) {
|
|
136
139
|
options |= CMARK_OPT_GITHUB_PRE_LANG;
|
137
140
|
} else if (strcmp(argv[i], "--safe") == 0) {
|
138
141
|
options |= CMARK_OPT_SAFE;
|
139
|
-
} else if (strcmp(argv[i], "--normalize") == 0) {
|
140
|
-
options |= CMARK_OPT_NORMALIZE;
|
141
142
|
} else if (strcmp(argv[i], "--validate-utf8") == 0) {
|
142
143
|
options |= CMARK_OPT_VALIDATE_UTF8;
|
144
|
+
} else if (strcmp(argv[i], "--liberal-html-tag") == 0) {
|
145
|
+
options |= CMARK_OPT_LIBERAL_HTML_TAG;
|
143
146
|
} else if ((strcmp(argv[i], "--help") == 0) ||
|
144
147
|
(strcmp(argv[i], "-h") == 0)) {
|
145
148
|
print_usage();
|
@@ -168,6 +171,8 @@ int main(int argc, char *argv[]) {
|
|
168
171
|
writer = FORMAT_XML;
|
169
172
|
} else if (strcmp(argv[i], "commonmark") == 0) {
|
170
173
|
writer = FORMAT_COMMONMARK;
|
174
|
+
} else if (strcmp(argv[i], "plaintext") == 0) {
|
175
|
+
writer = FORMAT_PLAINTEXT;
|
171
176
|
} else if (strcmp(argv[i], "latex") == 0) {
|
172
177
|
writer = FORMAT_LATEX;
|
173
178
|
} else {
|
@@ -0,0 +1,212 @@
|
|
1
|
+
#include "node.h"
|
2
|
+
#include "syntax_extension.h"
|
3
|
+
|
4
|
+
#define OUT(s, wrap, escaping) renderer->out(renderer, node, s, wrap, escaping)
|
5
|
+
#define LIT(s) renderer->out(renderer, node, s, false, LITERAL)
|
6
|
+
#define CR() renderer->cr(renderer)
|
7
|
+
#define BLANKLINE() renderer->blankline(renderer)
|
8
|
+
#define LISTMARKER_SIZE 20
|
9
|
+
|
10
|
+
// Functions to convert cmark_nodes to plain text strings.
|
11
|
+
|
12
|
+
static CMARK_INLINE void outc(cmark_renderer *renderer, cmark_node *node,
|
13
|
+
cmark_escaping escape,
|
14
|
+
int32_t c, unsigned char nextc) {
|
15
|
+
cmark_render_code_point(renderer, c);
|
16
|
+
}
|
17
|
+
|
18
|
+
// if node is a block node, returns node.
|
19
|
+
// otherwise returns first block-level node that is an ancestor of node.
|
20
|
+
// if there is no block-level ancestor, returns NULL.
|
21
|
+
static cmark_node *get_containing_block(cmark_node *node) {
|
22
|
+
while (node) {
|
23
|
+
if (CMARK_NODE_BLOCK_P(node)) {
|
24
|
+
return node;
|
25
|
+
} else {
|
26
|
+
node = node->parent;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return NULL;
|
30
|
+
}
|
31
|
+
|
32
|
+
static int S_render_node(cmark_renderer *renderer, cmark_node *node,
|
33
|
+
cmark_event_type ev_type, int options) {
|
34
|
+
cmark_node *tmp;
|
35
|
+
int list_number;
|
36
|
+
cmark_delim_type list_delim;
|
37
|
+
int i;
|
38
|
+
bool entering = (ev_type == CMARK_EVENT_ENTER);
|
39
|
+
char listmarker[LISTMARKER_SIZE];
|
40
|
+
bool first_in_list_item;
|
41
|
+
bufsize_t marker_width;
|
42
|
+
bool allow_wrap = renderer->width > 0 && !(CMARK_OPT_NOBREAKS & options) &&
|
43
|
+
!(CMARK_OPT_HARDBREAKS & options);
|
44
|
+
|
45
|
+
// Don't adjust tight list status til we've started the list.
|
46
|
+
// Otherwise we loose the blank line between a paragraph and
|
47
|
+
// a following list.
|
48
|
+
if (!(node->type == CMARK_NODE_ITEM && node->prev == NULL && entering)) {
|
49
|
+
tmp = get_containing_block(node);
|
50
|
+
renderer->in_tight_list_item =
|
51
|
+
tmp && // tmp might be NULL if there is no containing block
|
52
|
+
((tmp->type == CMARK_NODE_ITEM &&
|
53
|
+
cmark_node_get_list_tight(tmp->parent)) ||
|
54
|
+
(tmp && tmp->parent && tmp->parent->type == CMARK_NODE_ITEM &&
|
55
|
+
cmark_node_get_list_tight(tmp->parent->parent)));
|
56
|
+
}
|
57
|
+
|
58
|
+
if (node->extension && node->extension->plaintext_render_func) {
|
59
|
+
node->extension->plaintext_render_func(node->extension, renderer, node, ev_type, options);
|
60
|
+
return 1;
|
61
|
+
}
|
62
|
+
|
63
|
+
switch (node->type) {
|
64
|
+
case CMARK_NODE_DOCUMENT:
|
65
|
+
break;
|
66
|
+
|
67
|
+
case CMARK_NODE_BLOCK_QUOTE:
|
68
|
+
break;
|
69
|
+
|
70
|
+
case CMARK_NODE_LIST:
|
71
|
+
if (!entering && node->next && (node->next->type == CMARK_NODE_CODE_BLOCK ||
|
72
|
+
node->next->type == CMARK_NODE_LIST)) {
|
73
|
+
CR();
|
74
|
+
}
|
75
|
+
break;
|
76
|
+
|
77
|
+
case CMARK_NODE_ITEM:
|
78
|
+
if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
|
79
|
+
marker_width = 4;
|
80
|
+
} else {
|
81
|
+
list_number = cmark_node_get_list_start(node->parent);
|
82
|
+
list_delim = cmark_node_get_list_delim(node->parent);
|
83
|
+
tmp = node;
|
84
|
+
while (tmp->prev) {
|
85
|
+
tmp = tmp->prev;
|
86
|
+
list_number += 1;
|
87
|
+
}
|
88
|
+
// we ensure a width of at least 4 so
|
89
|
+
// we get nice transition from single digits
|
90
|
+
// to double
|
91
|
+
snprintf(listmarker, LISTMARKER_SIZE, "%d%s%s", list_number,
|
92
|
+
list_delim == CMARK_PAREN_DELIM ? ")" : ".",
|
93
|
+
list_number < 10 ? " " : " ");
|
94
|
+
marker_width = (bufsize_t)strlen(listmarker);
|
95
|
+
}
|
96
|
+
if (entering) {
|
97
|
+
if (cmark_node_get_list_type(node->parent) == CMARK_BULLET_LIST) {
|
98
|
+
LIT(" - ");
|
99
|
+
renderer->begin_content = true;
|
100
|
+
} else {
|
101
|
+
LIT(listmarker);
|
102
|
+
renderer->begin_content = true;
|
103
|
+
}
|
104
|
+
for (i = marker_width; i--;) {
|
105
|
+
cmark_strbuf_putc(renderer->prefix, ' ');
|
106
|
+
}
|
107
|
+
} else {
|
108
|
+
cmark_strbuf_truncate(renderer->prefix,
|
109
|
+
renderer->prefix->size - marker_width);
|
110
|
+
CR();
|
111
|
+
}
|
112
|
+
break;
|
113
|
+
|
114
|
+
case CMARK_NODE_HEADING:
|
115
|
+
if (entering) {
|
116
|
+
renderer->begin_content = true;
|
117
|
+
renderer->no_linebreaks = true;
|
118
|
+
} else {
|
119
|
+
renderer->no_linebreaks = false;
|
120
|
+
BLANKLINE();
|
121
|
+
}
|
122
|
+
break;
|
123
|
+
|
124
|
+
case CMARK_NODE_CODE_BLOCK:
|
125
|
+
first_in_list_item = node->prev == NULL && node->parent &&
|
126
|
+
node->parent->type == CMARK_NODE_ITEM;
|
127
|
+
|
128
|
+
if (!first_in_list_item) {
|
129
|
+
BLANKLINE();
|
130
|
+
}
|
131
|
+
OUT(cmark_node_get_literal(node), false, LITERAL);
|
132
|
+
BLANKLINE();
|
133
|
+
break;
|
134
|
+
|
135
|
+
case CMARK_NODE_HTML_BLOCK:
|
136
|
+
break;
|
137
|
+
|
138
|
+
case CMARK_NODE_CUSTOM_BLOCK:
|
139
|
+
break;
|
140
|
+
|
141
|
+
case CMARK_NODE_THEMATIC_BREAK:
|
142
|
+
BLANKLINE();
|
143
|
+
break;
|
144
|
+
|
145
|
+
case CMARK_NODE_PARAGRAPH:
|
146
|
+
if (!entering) {
|
147
|
+
BLANKLINE();
|
148
|
+
}
|
149
|
+
break;
|
150
|
+
|
151
|
+
case CMARK_NODE_TEXT:
|
152
|
+
OUT(cmark_node_get_literal(node), allow_wrap, NORMAL);
|
153
|
+
break;
|
154
|
+
|
155
|
+
case CMARK_NODE_LINEBREAK:
|
156
|
+
CR();
|
157
|
+
break;
|
158
|
+
|
159
|
+
case CMARK_NODE_SOFTBREAK:
|
160
|
+
if (CMARK_OPT_HARDBREAKS & options) {
|
161
|
+
CR();
|
162
|
+
} else if (!renderer->no_linebreaks && renderer->width == 0 &&
|
163
|
+
!(CMARK_OPT_HARDBREAKS & options) &&
|
164
|
+
!(CMARK_OPT_NOBREAKS & options)) {
|
165
|
+
CR();
|
166
|
+
} else {
|
167
|
+
OUT(" ", allow_wrap, LITERAL);
|
168
|
+
}
|
169
|
+
break;
|
170
|
+
|
171
|
+
case CMARK_NODE_CODE:
|
172
|
+
OUT(cmark_node_get_literal(node), allow_wrap, LITERAL);
|
173
|
+
break;
|
174
|
+
|
175
|
+
case CMARK_NODE_HTML_INLINE:
|
176
|
+
break;
|
177
|
+
|
178
|
+
case CMARK_NODE_CUSTOM_INLINE:
|
179
|
+
break;
|
180
|
+
|
181
|
+
case CMARK_NODE_STRONG:
|
182
|
+
break;
|
183
|
+
|
184
|
+
case CMARK_NODE_EMPH:
|
185
|
+
break;
|
186
|
+
|
187
|
+
case CMARK_NODE_LINK:
|
188
|
+
break;
|
189
|
+
|
190
|
+
case CMARK_NODE_IMAGE:
|
191
|
+
break;
|
192
|
+
|
193
|
+
default:
|
194
|
+
assert(false);
|
195
|
+
break;
|
196
|
+
}
|
197
|
+
|
198
|
+
return 1;
|
199
|
+
}
|
200
|
+
|
201
|
+
char *cmark_render_plaintext(cmark_node *root, int options, int width) {
|
202
|
+
return cmark_render_plaintext_with_mem(root, options, width, cmark_node_mem(root));
|
203
|
+
}
|
204
|
+
|
205
|
+
char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem) {
|
206
|
+
if (options & CMARK_OPT_HARDBREAKS) {
|
207
|
+
// disable breaking on width, since it has
|
208
|
+
// a different meaning with OPT_HARDBREAKS
|
209
|
+
width = 0;
|
210
|
+
}
|
211
|
+
return cmark_render(mem, root, options, width, outc, S_render_node);
|
212
|
+
}
|