commonmarker 0.17.6 → 0.17.7

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.

Files changed (405) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -7
  3. data/ext/commonmarker/{cmark/src/arena.c → arena.c} +0 -0
  4. data/ext/commonmarker/{cmark/extensions/autolink.c → autolink.c} +0 -0
  5. data/ext/commonmarker/{cmark/extensions/autolink.h → autolink.h} +0 -0
  6. data/ext/commonmarker/{cmark/src/blocks.c → blocks.c} +0 -0
  7. data/ext/commonmarker/{cmark/src/buffer.c → buffer.c} +0 -0
  8. data/ext/commonmarker/{cmark/src/buffer.h → buffer.h} +0 -0
  9. data/ext/commonmarker/{cmark/src/case_fold_switch.inc → case_fold_switch.inc} +0 -0
  10. data/ext/commonmarker/{cmark/src/chunk.h → chunk.h} +0 -0
  11. data/ext/commonmarker/{cmark → cmark-upstream}/CMakeLists.txt +0 -0
  12. data/ext/commonmarker/{cmark → cmark-upstream}/COPYING +0 -0
  13. data/ext/commonmarker/{cmark → cmark-upstream}/FindAsan.cmake +0 -0
  14. data/ext/commonmarker/{cmark → cmark-upstream}/Makefile +0 -0
  15. data/ext/commonmarker/{cmark → cmark-upstream}/Makefile.nmake +0 -0
  16. data/ext/commonmarker/{cmark → cmark-upstream}/README.md +0 -0
  17. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/CMakeLists.txt +0 -0
  18. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.cpp +0 -0
  19. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/cplusplus.h +0 -0
  20. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.c +0 -0
  21. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/harness.h +0 -0
  22. data/ext/commonmarker/{cmark → cmark-upstream}/api_test/main.c +0 -0
  23. data/ext/commonmarker/{cmark → cmark-upstream}/appveyor.yml +0 -0
  24. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-flat.md +0 -0
  25. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-bq-nested.md +0 -0
  26. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-code.md +0 -0
  27. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-fences.md +0 -0
  28. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-heading.md +0 -0
  29. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-hr.md +0 -0
  30. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-html.md +0 -0
  31. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-lheading.md +0 -0
  32. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-flat.md +0 -0
  33. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-list-nested.md +0 -0
  34. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-flat.md +0 -0
  35. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/block-ref-nested.md +0 -0
  36. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-autolink.md +0 -0
  37. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-backticks.md +0 -0
  38. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-flat.md +0 -0
  39. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-nested.md +0 -0
  40. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-em-worst.md +0 -0
  41. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-entity.md +0 -0
  42. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-escape.md +0 -0
  43. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-html.md +0 -0
  44. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-flat.md +0 -0
  45. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-links-nested.md +0 -0
  46. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/inline-newlines.md +0 -0
  47. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/lorem1.md +0 -0
  48. data/ext/commonmarker/{cmark → cmark-upstream}/bench/samples/rawtabs.md +0 -0
  49. data/ext/commonmarker/{cmark → cmark-upstream}/bench/statistics.py +0 -0
  50. data/ext/commonmarker/{cmark → cmark-upstream}/bench/stats.py +0 -0
  51. data/ext/commonmarker/{cmark → cmark-upstream}/benchmarks.md +0 -0
  52. data/ext/commonmarker/cmark-upstream/build/CMakeCache.txt +478 -0
  53. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCCompiler.cmake +71 -0
  54. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeCXXCompiler.cmake +73 -0
  55. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_C.bin +0 -0
  56. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeDetermineCompilerABI_CXX.bin +0 -0
  57. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CMakeSystem.cmake +15 -0
  58. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/CMakeCCompilerId.c +567 -0
  59. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdC/a.out +0 -0
  60. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/CMakeCXXCompilerId.cpp +539 -0
  61. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/3.9.6/CompilerIdCXX/a.out +0 -0
  62. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  63. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeError.log +18 -0
  64. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/CMakeOutput.log +709 -0
  65. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile.cmake +157 -0
  66. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/Makefile2 +391 -0
  67. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/TargetDirectories.txt +48 -0
  68. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/cmake.check_cache +1 -0
  69. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.bin +0 -0
  70. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.c +34 -0
  71. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/feature_tests.cxx +405 -0
  72. data/ext/commonmarker/cmark-upstream/build/CMakeFiles/progress.marks +1 -0
  73. data/ext/commonmarker/cmark-upstream/build/CTestTestfile.cmake +11 -0
  74. data/ext/commonmarker/cmark-upstream/build/Makefile +280 -0
  75. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  76. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/C.includecache +134 -0
  77. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/CXX.includecache +38 -0
  78. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +38 -0
  79. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/build.make +169 -0
  80. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +12 -0
  81. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o +0 -0
  82. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.internal +28 -0
  83. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/depend.make +28 -0
  84. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/flags.make +17 -0
  85. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/harness.c.o +0 -0
  86. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/link.txt +1 -0
  87. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/main.c.o +0 -0
  88. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/api_test.dir/progress.make +5 -0
  89. data/ext/commonmarker/cmark-upstream/build/api_test/CMakeFiles/progress.marks +1 -0
  90. data/ext/commonmarker/cmark-upstream/build/api_test/Makefile +302 -0
  91. data/ext/commonmarker/cmark-upstream/build/api_test/api_test +0 -0
  92. data/ext/commonmarker/cmark-upstream/build/api_test/cmake_install.cmake +29 -0
  93. data/ext/commonmarker/cmark-upstream/build/cmake_install.cmake +49 -0
  94. data/ext/commonmarker/cmark-upstream/build/compile_commands.json +352 -0
  95. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  96. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions-release.cmake +30 -0
  97. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions.cmake +108 -0
  98. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/C.includecache +246 -0
  99. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +36 -0
  100. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/autolink.c.o +0 -0
  101. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +253 -0
  102. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +16 -0
  103. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/core-extensions.c.o +0 -0
  104. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.internal +96 -0
  105. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +96 -0
  106. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/ext_scanners.c.o +0 -0
  107. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +10 -0
  108. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +1 -0
  109. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +8 -0
  110. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/strikethrough.c.o +0 -0
  111. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/table.c.o +0 -0
  112. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/tagfilter.c.o +0 -0
  113. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +246 -0
  114. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +29 -0
  115. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
  116. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +249 -0
  117. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +15 -0
  118. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +3 -0
  119. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
  120. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +96 -0
  121. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +96 -0
  122. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
  123. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +10 -0
  124. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +2 -0
  125. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +8 -0
  126. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
  127. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
  128. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
  129. data/ext/commonmarker/cmark-upstream/build/extensions/CMakeFiles/progress.marks +1 -0
  130. data/ext/commonmarker/cmark-upstream/build/extensions/Makefile +426 -0
  131. data/ext/commonmarker/cmark-upstream/build/extensions/cmake_install.cmake +84 -0
  132. data/ext/commonmarker/cmark-upstream/build/extensions/cmarkextensions_export.h +42 -0
  133. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.0.28.3.gfm.11.dylib +0 -0
  134. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.a +0 -0
  135. data/ext/commonmarker/cmark-upstream/build/extensions/libcmark-gfmextensions.dylib +1 -0
  136. data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  137. data/ext/commonmarker/cmark-upstream/build/man/CMakeFiles/progress.marks +1 -0
  138. data/ext/commonmarker/cmark-upstream/build/man/Makefile +196 -0
  139. data/ext/commonmarker/cmark-upstream/build/man/cmake_install.cmake +37 -0
  140. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  141. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm-release.cmake +38 -0
  142. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/Export/lib/cmake/cmark-gfm.cmake +95 -0
  143. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/C.includecache +156 -0
  144. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +30 -0
  145. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/build.make +115 -0
  146. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +10 -0
  147. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.internal +20 -0
  148. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/depend.make +20 -0
  149. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/flags.make +10 -0
  150. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/link.txt +1 -0
  151. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/main.c.o +0 -0
  152. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/cmark-gfm.dir/progress.make +3 -0
  153. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/C.includecache +612 -0
  154. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +60 -0
  155. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/arena.c.o +0 -0
  156. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/blocks.c.o +0 -0
  157. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/buffer.c.o +0 -0
  158. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/build.make +819 -0
  159. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +37 -0
  160. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark.c.o +0 -0
  161. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/cmark_ctype.c.o +0 -0
  162. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/commonmark.c.o +0 -0
  163. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.internal +319 -0
  164. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +319 -0
  165. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +10 -0
  166. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/footnotes.c.o +0 -0
  167. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_href_e.c.o +0 -0
  168. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_e.c.o +0 -0
  169. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/houdini_html_u.c.o +0 -0
  170. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/html.c.o +0 -0
  171. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/inlines.c.o +0 -0
  172. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/iterator.c.o +0 -0
  173. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/latex.c.o +0 -0
  174. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +1 -0
  175. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/linked_list.c.o +0 -0
  176. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/man.c.o +0 -0
  177. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/map.c.o +0 -0
  178. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/node.c.o +0 -0
  179. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plaintext.c.o +0 -0
  180. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/plugin.c.o +0 -0
  181. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +29 -0
  182. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/references.c.o +0 -0
  183. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/registry.c.o +0 -0
  184. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/render.c.o +0 -0
  185. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/scanners.c.o +0 -0
  186. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/syntax_extension.c.o +0 -0
  187. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/utf8.c.o +0 -0
  188. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm.dir/xml.c.o +0 -0
  189. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +612 -0
  190. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +54 -0
  191. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
  192. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
  193. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
  194. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +816 -0
  195. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +36 -0
  196. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +3 -0
  197. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
  198. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
  199. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
  200. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +319 -0
  201. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +319 -0
  202. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +10 -0
  203. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/footnotes.c.o +0 -0
  204. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
  205. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
  206. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
  207. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
  208. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
  209. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
  210. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
  211. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +2 -0
  212. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
  213. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
  214. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/map.c.o +0 -0
  215. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
  216. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
  217. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
  218. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +29 -0
  219. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
  220. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
  221. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
  222. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
  223. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
  224. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
  225. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
  226. data/ext/commonmarker/cmark-upstream/build/src/CMakeFiles/progress.marks +1 -0
  227. data/ext/commonmarker/cmark-upstream/build/src/Makefile +1165 -0
  228. data/ext/commonmarker/cmark-upstream/build/src/cmake_install.cmake +97 -0
  229. data/ext/commonmarker/cmark-upstream/build/src/cmark-gfm +0 -0
  230. data/ext/commonmarker/cmark-upstream/build/src/cmark_export.h +42 -0
  231. data/ext/commonmarker/cmark-upstream/build/src/cmark_version.h +8 -0
  232. data/ext/commonmarker/cmark-upstream/build/src/config.h +76 -0
  233. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.0.28.3.gfm.11.dylib +0 -0
  234. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.a +0 -0
  235. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.dylib +1 -0
  236. data/ext/commonmarker/cmark-upstream/build/src/libcmark-gfm.pc +10 -0
  237. data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  238. data/ext/commonmarker/cmark-upstream/build/testdir/CMakeFiles/progress.marks +1 -0
  239. data/ext/commonmarker/cmark-upstream/build/testdir/CTestTestfile.cmake +17 -0
  240. data/ext/commonmarker/cmark-upstream/build/testdir/Makefile +196 -0
  241. data/ext/commonmarker/cmark-upstream/build/testdir/cmake_install.cmake +29 -0
  242. data/ext/commonmarker/{cmark → cmark-upstream}/changelog.txt +0 -0
  243. data/ext/commonmarker/{cmark → cmark-upstream}/data/CaseFolding.txt +0 -0
  244. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/CMakeLists.txt +0 -0
  245. data/ext/commonmarker/cmark-upstream/extensions/autolink.c +421 -0
  246. data/ext/commonmarker/cmark-upstream/extensions/autolink.h +8 -0
  247. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.c +0 -0
  248. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/core-extensions.h +0 -0
  249. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.c +0 -0
  250. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.h +0 -0
  251. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/ext_scanners.re +0 -0
  252. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.c +0 -0
  253. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/strikethrough.h +0 -0
  254. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.c +0 -0
  255. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/table.h +0 -0
  256. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.c +0 -0
  257. data/ext/commonmarker/{cmark → cmark-upstream}/extensions/tagfilter.h +0 -0
  258. data/ext/commonmarker/{cmark → cmark-upstream}/man/CMakeLists.txt +0 -0
  259. data/ext/commonmarker/{cmark → cmark-upstream}/man/make_man_page.py +0 -0
  260. data/ext/commonmarker/{cmark → cmark-upstream}/man/man1/cmark-gfm.1 +0 -0
  261. data/ext/commonmarker/{cmark → cmark-upstream}/man/man3/cmark-gfm.3 +0 -0
  262. data/ext/commonmarker/{cmark → cmark-upstream}/nmake.bat +0 -0
  263. data/ext/commonmarker/{cmark → cmark-upstream}/src/CMakeLists.txt +0 -0
  264. data/ext/commonmarker/cmark-upstream/src/arena.c +103 -0
  265. data/ext/commonmarker/cmark-upstream/src/blocks.c +1519 -0
  266. data/ext/commonmarker/cmark-upstream/src/buffer.c +279 -0
  267. data/ext/commonmarker/cmark-upstream/src/buffer.h +116 -0
  268. data/ext/commonmarker/cmark-upstream/src/case_fold_switch.inc +4327 -0
  269. data/ext/commonmarker/cmark-upstream/src/chunk.h +136 -0
  270. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.c +0 -0
  271. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark.h +0 -0
  272. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.c +0 -0
  273. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_ctype.h +0 -0
  274. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_extension_api.h +0 -0
  275. data/ext/commonmarker/{cmark → cmark-upstream}/src/cmark_version.h.in +0 -0
  276. data/ext/commonmarker/{cmark → cmark-upstream}/src/commonmark.c +0 -0
  277. data/ext/commonmarker/{cmark → cmark-upstream}/src/config.h.in +0 -0
  278. data/ext/commonmarker/{cmark → cmark-upstream}/src/entities.inc +0 -0
  279. data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.c +0 -0
  280. data/ext/commonmarker/{cmark → cmark-upstream}/src/footnotes.h +0 -0
  281. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini.h +0 -0
  282. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_href_e.c +0 -0
  283. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_e.c +0 -0
  284. data/ext/commonmarker/{cmark → cmark-upstream}/src/houdini_html_u.c +0 -0
  285. data/ext/commonmarker/{cmark → cmark-upstream}/src/html.c +0 -0
  286. data/ext/commonmarker/{cmark → cmark-upstream}/src/html.h +0 -0
  287. data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.c +8 -4
  288. data/ext/commonmarker/{cmark → cmark-upstream}/src/inlines.h +0 -0
  289. data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.c +0 -0
  290. data/ext/commonmarker/{cmark → cmark-upstream}/src/iterator.h +0 -0
  291. data/ext/commonmarker/{cmark → cmark-upstream}/src/latex.c +0 -0
  292. data/ext/commonmarker/{cmark → cmark-upstream}/src/libcmark-gfm.pc.in +0 -0
  293. data/ext/commonmarker/{cmark → cmark-upstream}/src/linked_list.c +0 -0
  294. data/ext/commonmarker/{cmark → cmark-upstream}/src/main.c +0 -0
  295. data/ext/commonmarker/{cmark → cmark-upstream}/src/man.c +0 -0
  296. data/ext/commonmarker/{cmark → cmark-upstream}/src/map.c +0 -0
  297. data/ext/commonmarker/{cmark → cmark-upstream}/src/map.h +0 -0
  298. data/ext/commonmarker/{cmark → cmark-upstream}/src/node.c +0 -0
  299. data/ext/commonmarker/{cmark → cmark-upstream}/src/node.h +0 -0
  300. data/ext/commonmarker/{cmark → cmark-upstream}/src/parser.h +0 -0
  301. data/ext/commonmarker/{cmark → cmark-upstream}/src/plaintext.c +0 -0
  302. data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.c +0 -0
  303. data/ext/commonmarker/{cmark → cmark-upstream}/src/plugin.h +0 -0
  304. data/ext/commonmarker/{cmark → cmark-upstream}/src/references.c +0 -0
  305. data/ext/commonmarker/{cmark → cmark-upstream}/src/references.h +0 -0
  306. data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.c +0 -0
  307. data/ext/commonmarker/{cmark → cmark-upstream}/src/registry.h +0 -0
  308. data/ext/commonmarker/{cmark → cmark-upstream}/src/render.c +0 -0
  309. data/ext/commonmarker/{cmark → cmark-upstream}/src/render.h +0 -0
  310. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.c +0 -0
  311. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.h +0 -0
  312. data/ext/commonmarker/{cmark → cmark-upstream}/src/scanners.re +0 -0
  313. data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.c +0 -0
  314. data/ext/commonmarker/{cmark → cmark-upstream}/src/syntax_extension.h +0 -0
  315. data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.c +0 -0
  316. data/ext/commonmarker/{cmark → cmark-upstream}/src/utf8.h +0 -0
  317. data/ext/commonmarker/{cmark → cmark-upstream}/src/xml.c +0 -0
  318. data/ext/commonmarker/{cmark → cmark-upstream}/suppressions +0 -0
  319. data/ext/commonmarker/{cmark → cmark-upstream}/test/CMakeLists.txt +0 -0
  320. data/ext/commonmarker/{cmark → cmark-upstream}/test/afl_test_cases/test.md +0 -0
  321. data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark-fuzz.c +0 -0
  322. data/ext/commonmarker/{cmark → cmark-upstream}/test/cmark.py +0 -0
  323. data/ext/commonmarker/{cmark → cmark-upstream}/test/entity_tests.py +0 -0
  324. data/ext/commonmarker/{cmark → cmark-upstream}/test/extensions.txt +2 -2
  325. data/ext/commonmarker/{cmark → cmark-upstream}/test/fuzzing_dictionary +0 -0
  326. data/ext/commonmarker/{cmark → cmark-upstream}/test/normalize.py +0 -0
  327. data/ext/commonmarker/{cmark → cmark-upstream}/test/pathological_tests.py +0 -0
  328. data/ext/commonmarker/{cmark → cmark-upstream}/test/regression.txt +0 -0
  329. data/ext/commonmarker/{cmark → cmark-upstream}/test/roundtrip_tests.py +0 -0
  330. data/ext/commonmarker/{cmark → cmark-upstream}/test/run-cmark-fuzz +0 -0
  331. data/ext/commonmarker/{cmark → cmark-upstream}/test/smart_punct.txt +0 -0
  332. data/ext/commonmarker/{cmark → cmark-upstream}/test/spec.txt +0 -0
  333. data/ext/commonmarker/{cmark → cmark-upstream}/test/spec_tests.py +0 -0
  334. data/ext/commonmarker/{cmark → cmark-upstream}/toolchain-mingw32.cmake +0 -0
  335. data/ext/commonmarker/{cmark → cmark-upstream}/tools/Dockerfile +0 -0
  336. data/ext/commonmarker/{cmark → cmark-upstream}/tools/appveyor-build.bat +0 -0
  337. data/ext/commonmarker/{cmark → cmark-upstream}/tools/make_entities_inc.py +0 -0
  338. data/ext/commonmarker/{cmark → cmark-upstream}/tools/mkcasefold.pl +0 -0
  339. data/ext/commonmarker/{cmark → cmark-upstream}/why-cmark-and-not-x.md +0 -0
  340. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.js +0 -0
  341. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.py +0 -0
  342. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rb +0 -0
  343. data/ext/commonmarker/{cmark → cmark-upstream}/wrappers/wrapper.rkt +0 -0
  344. data/ext/commonmarker/cmark.c +55 -0
  345. data/ext/commonmarker/cmark.h +789 -0
  346. data/ext/commonmarker/cmark_ctype.c +44 -0
  347. data/ext/commonmarker/cmark_ctype.h +33 -0
  348. data/ext/commonmarker/cmark_export.h +42 -0
  349. data/ext/commonmarker/cmark_extension_api.h +719 -0
  350. data/ext/commonmarker/cmark_version.h +8 -0
  351. data/ext/commonmarker/cmarkextensions_export.h +42 -0
  352. data/ext/commonmarker/commonmark.c +508 -0
  353. data/ext/commonmarker/config.h +76 -0
  354. data/ext/commonmarker/core-extensions.c +25 -0
  355. data/ext/commonmarker/core-extensions.h +25 -0
  356. data/ext/commonmarker/entities.inc +2138 -0
  357. data/ext/commonmarker/ext_scanners.c +941 -0
  358. data/ext/commonmarker/ext_scanners.h +22 -0
  359. data/ext/commonmarker/extconf.rb +1 -48
  360. data/ext/commonmarker/footnotes.c +40 -0
  361. data/ext/commonmarker/footnotes.h +25 -0
  362. data/ext/commonmarker/houdini.h +57 -0
  363. data/ext/commonmarker/houdini_href_e.c +100 -0
  364. data/ext/commonmarker/houdini_html_e.c +66 -0
  365. data/ext/commonmarker/houdini_html_u.c +149 -0
  366. data/ext/commonmarker/html.c +457 -0
  367. data/ext/commonmarker/html.h +27 -0
  368. data/ext/commonmarker/inlines.c +1594 -0
  369. data/ext/commonmarker/inlines.h +29 -0
  370. data/ext/commonmarker/iterator.c +159 -0
  371. data/ext/commonmarker/iterator.h +27 -0
  372. data/ext/commonmarker/latex.c +466 -0
  373. data/ext/commonmarker/linked_list.c +37 -0
  374. data/ext/commonmarker/man.c +278 -0
  375. data/ext/commonmarker/map.c +122 -0
  376. data/ext/commonmarker/map.h +42 -0
  377. data/ext/commonmarker/node.c +965 -0
  378. data/ext/commonmarker/node.h +116 -0
  379. data/ext/commonmarker/parser.h +57 -0
  380. data/ext/commonmarker/plaintext.c +213 -0
  381. data/ext/commonmarker/plugin.c +36 -0
  382. data/ext/commonmarker/plugin.h +34 -0
  383. data/ext/commonmarker/references.c +42 -0
  384. data/ext/commonmarker/references.h +26 -0
  385. data/ext/commonmarker/registry.c +63 -0
  386. data/ext/commonmarker/registry.h +24 -0
  387. data/ext/commonmarker/render.c +202 -0
  388. data/ext/commonmarker/render.h +63 -0
  389. data/ext/commonmarker/scanners.c +18195 -0
  390. data/ext/commonmarker/scanners.h +64 -0
  391. data/ext/commonmarker/scanners.re +341 -0
  392. data/ext/commonmarker/strikethrough.c +157 -0
  393. data/ext/commonmarker/strikethrough.h +9 -0
  394. data/ext/commonmarker/syntax_extension.c +139 -0
  395. data/ext/commonmarker/syntax_extension.h +32 -0
  396. data/ext/commonmarker/table.c +683 -0
  397. data/ext/commonmarker/table.h +8 -0
  398. data/ext/commonmarker/tagfilter.c +60 -0
  399. data/ext/commonmarker/tagfilter.h +8 -0
  400. data/ext/commonmarker/utf8.c +317 -0
  401. data/ext/commonmarker/utf8.h +35 -0
  402. data/ext/commonmarker/xml.c +174 -0
  403. data/lib/commonmarker/version.rb +1 -1
  404. data/test/test_helper.rb +1 -1
  405. metadata +401 -145
@@ -0,0 +1,136 @@
1
+ #ifndef CMARK_CHUNK_H
2
+ #define CMARK_CHUNK_H
3
+
4
+ #include <string.h>
5
+ #include <stdlib.h>
6
+ #include <assert.h>
7
+ #include "cmark.h"
8
+ #include "buffer.h"
9
+ #include "memory.h"
10
+ #include "cmark_ctype.h"
11
+
12
+ #define CMARK_CHUNK_EMPTY \
13
+ { NULL, 0, 0 }
14
+
15
+ typedef struct cmark_chunk {
16
+ unsigned char *data;
17
+ bufsize_t len;
18
+ bufsize_t alloc; // also implies a NULL-terminated string
19
+ } cmark_chunk;
20
+
21
+ static CMARK_INLINE void cmark_chunk_free(cmark_mem *mem, cmark_chunk *c) {
22
+ if (c->alloc)
23
+ mem->free(c->data);
24
+
25
+ c->data = NULL;
26
+ c->alloc = 0;
27
+ c->len = 0;
28
+ }
29
+
30
+ static CMARK_INLINE void cmark_chunk_ltrim(cmark_chunk *c) {
31
+ assert(!c->alloc);
32
+
33
+ while (c->len && cmark_isspace(c->data[0])) {
34
+ c->data++;
35
+ c->len--;
36
+ }
37
+ }
38
+
39
+ static CMARK_INLINE void cmark_chunk_rtrim(cmark_chunk *c) {
40
+ assert(!c->alloc);
41
+
42
+ while (c->len > 0) {
43
+ if (!cmark_isspace(c->data[c->len - 1]))
44
+ break;
45
+
46
+ c->len--;
47
+ }
48
+ }
49
+
50
+ static CMARK_INLINE void cmark_chunk_trim(cmark_chunk *c) {
51
+ cmark_chunk_ltrim(c);
52
+ cmark_chunk_rtrim(c);
53
+ }
54
+
55
+ static CMARK_INLINE bufsize_t cmark_chunk_strchr(cmark_chunk *ch, int c,
56
+ bufsize_t offset) {
57
+ const unsigned char *p =
58
+ (unsigned char *)memchr(ch->data + offset, c, ch->len - offset);
59
+ return p ? (bufsize_t)(p - ch->data) : ch->len;
60
+ }
61
+
62
+ static CMARK_INLINE const char *cmark_chunk_to_cstr(cmark_mem *mem,
63
+ cmark_chunk *c) {
64
+ unsigned char *str;
65
+
66
+ if (c->alloc) {
67
+ return (char *)c->data;
68
+ }
69
+ str = (unsigned char *)mem->calloc(c->len + 1, 1);
70
+ if (c->len > 0) {
71
+ memcpy(str, c->data, c->len);
72
+ }
73
+ str[c->len] = 0;
74
+ c->data = str;
75
+ c->alloc = 1;
76
+
77
+ return (char *)str;
78
+ }
79
+
80
+ static CMARK_INLINE void cmark_chunk_set_cstr(cmark_mem *mem, cmark_chunk *c,
81
+ const char *str) {
82
+ unsigned char *old = c->alloc ? c->data : NULL;
83
+ if (str == NULL) {
84
+ c->len = 0;
85
+ c->data = NULL;
86
+ c->alloc = 0;
87
+ } else {
88
+ c->len = (bufsize_t)strlen(str);
89
+ c->data = (unsigned char *)mem->calloc(c->len + 1, 1);
90
+ c->alloc = 1;
91
+ memcpy(c->data, str, c->len + 1);
92
+ }
93
+ if (old != NULL) {
94
+ mem->free(old);
95
+ }
96
+ }
97
+
98
+ static CMARK_INLINE cmark_chunk cmark_chunk_literal(const char *data) {
99
+ bufsize_t len = data ? (bufsize_t)strlen(data) : 0;
100
+ cmark_chunk c = {(unsigned char *)data, len, 0};
101
+ return c;
102
+ }
103
+
104
+ static CMARK_INLINE cmark_chunk cmark_chunk_dup(const cmark_chunk *ch,
105
+ bufsize_t pos, bufsize_t len) {
106
+ cmark_chunk c = {ch->data + pos, len, 0};
107
+ return c;
108
+ }
109
+
110
+ static CMARK_INLINE cmark_chunk cmark_chunk_buf_detach(cmark_strbuf *buf) {
111
+ cmark_chunk c;
112
+
113
+ c.len = buf->size;
114
+ c.data = cmark_strbuf_detach(buf);
115
+ c.alloc = 1;
116
+
117
+ return c;
118
+ }
119
+
120
+ /* trim_new variants are to be used when the source chunk may or may not be
121
+ * allocated; forces a newly allocated chunk. */
122
+ static CMARK_INLINE cmark_chunk cmark_chunk_ltrim_new(cmark_mem *mem, cmark_chunk *c) {
123
+ cmark_chunk r = cmark_chunk_dup(c, 0, c->len);
124
+ cmark_chunk_ltrim(&r);
125
+ cmark_chunk_to_cstr(mem, &r);
126
+ return r;
127
+ }
128
+
129
+ static CMARK_INLINE cmark_chunk cmark_chunk_rtrim_new(cmark_mem *mem, cmark_chunk *c) {
130
+ cmark_chunk r = cmark_chunk_dup(c, 0, c->len);
131
+ cmark_chunk_rtrim(&r);
132
+ cmark_chunk_to_cstr(mem, &r);
133
+ return r;
134
+ }
135
+
136
+ #endif
@@ -176,11 +176,15 @@ static void subject_from_buf(cmark_mem *mem, int line_number, int block_offset,
176
176
 
177
177
  static CMARK_INLINE int isbacktick(int c) { return (c == '`'); }
178
178
 
179
- static CMARK_INLINE unsigned char peek_char(subject *subj) {
179
+ static CMARK_INLINE unsigned char peek_char_n(subject *subj, bufsize_t n) {
180
180
  // NULL bytes should have been stripped out by now. If they're
181
181
  // present, it's a programming error:
182
- assert(!(subj->pos < subj->input.len && subj->input.data[subj->pos] == 0));
183
- return (subj->pos < subj->input.len) ? subj->input.data[subj->pos] : 0;
182
+ assert(!(subj->pos + n < subj->input.len && subj->input.data[subj->pos + n] == 0));
183
+ return (subj->pos + n < subj->input.len) ? subj->input.data[subj->pos + n] : 0;
184
+ }
185
+
186
+ static CMARK_INLINE unsigned char peek_char(subject *subj) {
187
+ return peek_char_n(subj, 0);
184
188
  }
185
189
 
186
190
  static CMARK_INLINE unsigned char peek_at(subject *subj, bufsize_t pos) {
@@ -1303,7 +1307,7 @@ static int parse_inline(cmark_parser *parser, subject *subj, cmark_node *parent,
1303
1307
  break;
1304
1308
  case '!':
1305
1309
  advance(subj);
1306
- if (peek_char(subj) == '[') {
1310
+ if (peek_char(subj) == '[' && peek_char_n(subj, 1) != '^') {
1307
1311
  advance(subj);
1308
1312
  new_inl = make_str(subj, subj->pos - 2, subj->pos - 1, cmark_chunk_literal("!["));
1309
1313
  push_bracket(subj, true, new_inl);
@@ -582,7 +582,7 @@ Even with {"x":"y"} or 1 > 2 or whatever. Even **markdown**.
582
582
  ## Footnotes
583
583
 
584
584
  ```````````````````````````````` example
585
- This is some text.[^1]. Other text.[^footnote].
585
+ This is some text![^1]. Other text.[^footnote].
586
586
 
587
587
  Here's a thing[^other-note].
588
588
 
@@ -609,7 +609,7 @@ Hi!
609
609
 
610
610
  [^unused]: This is unused.
611
611
  .
612
- <p>This is some text.<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Other text.<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.</p>
612
+ <p>This is some text!<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup>. Other text.<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>.</p>
613
613
  <p>Here's a thing<sup class="footnote-ref"><a href="#fn3" id="fnref3">[3]</a></sup>.</p>
614
614
  <p>And another thing<sup class="footnote-ref"><a href="#fn4" id="fnref4">[4]</a></sup>.</p>
615
615
  <p>This doesn't have a referent[^nope].</p>
@@ -0,0 +1,55 @@
1
+ #include <stdlib.h>
2
+ #include <assert.h>
3
+ #include <stdio.h>
4
+ #include "registry.h"
5
+ #include "node.h"
6
+ #include "houdini.h"
7
+ #include "cmark.h"
8
+ #include "buffer.h"
9
+
10
+ cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_FOOTNOTE_DEFINITION;
11
+ cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_FOOTNOTE_REFERENCE;
12
+
13
+ int cmark_version() { return CMARK_VERSION; }
14
+
15
+ const char *cmark_version_string() { return CMARK_VERSION_STRING; }
16
+
17
+ static void *xcalloc(size_t nmem, size_t size) {
18
+ void *ptr = calloc(nmem, size);
19
+ if (!ptr) {
20
+ fprintf(stderr, "[cmark] calloc returned null pointer, aborting\n");
21
+ abort();
22
+ }
23
+ return ptr;
24
+ }
25
+
26
+ static void *xrealloc(void *ptr, size_t size) {
27
+ void *new_ptr = realloc(ptr, size);
28
+ if (!new_ptr) {
29
+ fprintf(stderr, "[cmark] realloc returned null pointer, aborting\n");
30
+ abort();
31
+ }
32
+ return new_ptr;
33
+ }
34
+
35
+ static void xfree(void *ptr) {
36
+ free(ptr);
37
+ }
38
+
39
+ cmark_mem CMARK_DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, xfree};
40
+
41
+ cmark_mem *cmark_get_default_mem_allocator() {
42
+ return &CMARK_DEFAULT_MEM_ALLOCATOR;
43
+ }
44
+
45
+ char *cmark_markdown_to_html(const char *text, size_t len, int options) {
46
+ cmark_node *doc;
47
+ char *result;
48
+
49
+ doc = cmark_parse_document(text, len, options);
50
+
51
+ result = cmark_render_html(doc, options, NULL);
52
+ cmark_node_free(doc);
53
+
54
+ return result;
55
+ }
@@ -0,0 +1,789 @@
1
+ #ifndef CMARK_CMARK_H
2
+ #define CMARK_CMARK_H
3
+
4
+ #include <stdio.h>
5
+ #include <stdint.h>
6
+ #include "cmark_export.h"
7
+ #include "cmark_version.h"
8
+
9
+ #ifdef __cplusplus
10
+ extern "C" {
11
+ #endif
12
+
13
+ /** # NAME
14
+ *
15
+ * **cmark-gfm** - CommonMark parsing, manipulating, and rendering
16
+ */
17
+
18
+ /** # DESCRIPTION
19
+ *
20
+ * ## Simple Interface
21
+ */
22
+
23
+ /** Convert 'text' (assumed to be a UTF-8 encoded string with length
24
+ * 'len') from CommonMark Markdown to HTML, returning a null-terminated,
25
+ * UTF-8-encoded string. It is the caller's responsibility
26
+ * to free the returned buffer.
27
+ */
28
+ CMARK_EXPORT
29
+ char *cmark_markdown_to_html(const char *text, size_t len, int options);
30
+
31
+ /** ## Node Structure
32
+ */
33
+
34
+ #define CMARK_NODE_TYPE_PRESENT (0x8000)
35
+ #define CMARK_NODE_TYPE_BLOCK (CMARK_NODE_TYPE_PRESENT | 0x0000)
36
+ #define CMARK_NODE_TYPE_INLINE (CMARK_NODE_TYPE_PRESENT | 0x4000)
37
+ #define CMARK_NODE_TYPE_MASK (0xc000)
38
+ #define CMARK_NODE_VALUE_MASK (0x3fff)
39
+
40
+ typedef enum {
41
+ /* Error status */
42
+ CMARK_NODE_NONE = 0x0000,
43
+
44
+ /* Block */
45
+ CMARK_NODE_DOCUMENT = CMARK_NODE_TYPE_BLOCK | 0x0001,
46
+ CMARK_NODE_BLOCK_QUOTE = CMARK_NODE_TYPE_BLOCK | 0x0002,
47
+ CMARK_NODE_LIST = CMARK_NODE_TYPE_BLOCK | 0x0003,
48
+ CMARK_NODE_ITEM = CMARK_NODE_TYPE_BLOCK | 0x0004,
49
+ CMARK_NODE_CODE_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0005,
50
+ CMARK_NODE_HTML_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0006,
51
+ CMARK_NODE_CUSTOM_BLOCK = CMARK_NODE_TYPE_BLOCK | 0x0007,
52
+ CMARK_NODE_PARAGRAPH = CMARK_NODE_TYPE_BLOCK | 0x0008,
53
+ CMARK_NODE_HEADING = CMARK_NODE_TYPE_BLOCK | 0x0009,
54
+ CMARK_NODE_THEMATIC_BREAK = CMARK_NODE_TYPE_BLOCK | 0x000a,
55
+ CMARK_NODE_FOOTNOTE_DEFINITION = CMARK_NODE_TYPE_BLOCK | 0x000b,
56
+
57
+ /* Inline */
58
+ CMARK_NODE_TEXT = CMARK_NODE_TYPE_INLINE | 0x0001,
59
+ CMARK_NODE_SOFTBREAK = CMARK_NODE_TYPE_INLINE | 0x0002,
60
+ CMARK_NODE_LINEBREAK = CMARK_NODE_TYPE_INLINE | 0x0003,
61
+ CMARK_NODE_CODE = CMARK_NODE_TYPE_INLINE | 0x0004,
62
+ CMARK_NODE_HTML_INLINE = CMARK_NODE_TYPE_INLINE | 0x0005,
63
+ CMARK_NODE_CUSTOM_INLINE = CMARK_NODE_TYPE_INLINE | 0x0006,
64
+ CMARK_NODE_EMPH = CMARK_NODE_TYPE_INLINE | 0x0007,
65
+ CMARK_NODE_STRONG = CMARK_NODE_TYPE_INLINE | 0x0008,
66
+ CMARK_NODE_LINK = CMARK_NODE_TYPE_INLINE | 0x0009,
67
+ CMARK_NODE_IMAGE = CMARK_NODE_TYPE_INLINE | 0x000a,
68
+ CMARK_NODE_FOOTNOTE_REFERENCE = CMARK_NODE_TYPE_INLINE | 0x000b,
69
+ } cmark_node_type;
70
+
71
+ extern cmark_node_type CMARK_NODE_LAST_BLOCK;
72
+ extern cmark_node_type CMARK_NODE_LAST_INLINE;
73
+
74
+ /* For backwards compatibility: */
75
+ #define CMARK_NODE_HEADER CMARK_NODE_HEADING
76
+ #define CMARK_NODE_HRULE CMARK_NODE_THEMATIC_BREAK
77
+ #define CMARK_NODE_HTML CMARK_NODE_HTML_BLOCK
78
+ #define CMARK_NODE_INLINE_HTML CMARK_NODE_HTML_INLINE
79
+
80
+ typedef enum {
81
+ CMARK_NO_LIST,
82
+ CMARK_BULLET_LIST,
83
+ CMARK_ORDERED_LIST
84
+ } cmark_list_type;
85
+
86
+ typedef enum {
87
+ CMARK_NO_DELIM,
88
+ CMARK_PERIOD_DELIM,
89
+ CMARK_PAREN_DELIM
90
+ } cmark_delim_type;
91
+
92
+ typedef struct cmark_node cmark_node;
93
+ typedef struct cmark_parser cmark_parser;
94
+ typedef struct cmark_iter cmark_iter;
95
+
96
+ /**
97
+ * ## Custom memory allocator support
98
+ */
99
+
100
+ /** Defines the memory allocation functions to be used by CMark
101
+ * when parsing and allocating a document tree
102
+ */
103
+ typedef struct cmark_mem {
104
+ void *(*calloc)(size_t, size_t);
105
+ void *(*realloc)(void *, size_t);
106
+ void (*free)(void *);
107
+ } cmark_mem;
108
+
109
+ /** The default memory allocator; uses the system's calloc,
110
+ * realloc and free.
111
+ */
112
+ CMARK_EXPORT
113
+ cmark_mem *cmark_get_default_mem_allocator();
114
+
115
+ /** An arena allocator; uses system calloc to allocate large
116
+ * slabs of memory. Memory in these slabs is not reused at all.
117
+ */
118
+ CMARK_EXPORT
119
+ cmark_mem *cmark_get_arena_mem_allocator();
120
+
121
+ /** Resets the arena allocator, quickly returning all used memory
122
+ * to the operating system.
123
+ */
124
+ CMARK_EXPORT
125
+ void cmark_arena_reset(void);
126
+
127
+ /** Callback for freeing user data with a 'cmark_mem' context.
128
+ */
129
+ typedef void (*cmark_free_func) (cmark_mem *mem, void *user_data);
130
+
131
+
132
+ /*
133
+ * ## Basic data structures
134
+ *
135
+ * To keep dependencies to the strict minimum, libcmark implements
136
+ * its own versions of "classic" data structures.
137
+ */
138
+
139
+ /**
140
+ * ### Linked list
141
+ */
142
+
143
+ /** A generic singly linked list.
144
+ */
145
+ typedef struct _cmark_llist
146
+ {
147
+ struct _cmark_llist *next;
148
+ void *data;
149
+ } cmark_llist;
150
+
151
+ /** Append an element to the linked list, return the possibly modified
152
+ * head of the list.
153
+ */
154
+ CMARK_EXPORT
155
+ cmark_llist * cmark_llist_append (cmark_mem * mem,
156
+ cmark_llist * head,
157
+ void * data);
158
+
159
+ /** Free the list starting with 'head', calling 'free_func' with the
160
+ * data pointer of each of its elements
161
+ */
162
+ CMARK_EXPORT
163
+ void cmark_llist_free_full (cmark_mem * mem,
164
+ cmark_llist * head,
165
+ cmark_free_func free_func);
166
+
167
+ /** Free the list starting with 'head'
168
+ */
169
+ CMARK_EXPORT
170
+ void cmark_llist_free (cmark_mem * mem,
171
+ cmark_llist * head);
172
+
173
+ /**
174
+ * ## Creating and Destroying Nodes
175
+ */
176
+
177
+ /** Creates a new node of type 'type'. Note that the node may have
178
+ * other required properties, which it is the caller's responsibility
179
+ * to assign.
180
+ */
181
+ CMARK_EXPORT cmark_node *cmark_node_new(cmark_node_type type);
182
+
183
+ /** Same as `cmark_node_new`, but explicitly listing the memory
184
+ * allocator used to allocate the node. Note: be sure to use the same
185
+ * allocator for every node in a tree, or bad things can happen.
186
+ */
187
+ CMARK_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type,
188
+ cmark_mem *mem);
189
+
190
+ /** Frees the memory allocated for a node and any children.
191
+ */
192
+ CMARK_EXPORT void cmark_node_free(cmark_node *node);
193
+
194
+ /**
195
+ * ## Tree Traversal
196
+ */
197
+
198
+ /** Returns the next node in the sequence after 'node', or NULL if
199
+ * there is none.
200
+ */
201
+ CMARK_EXPORT cmark_node *cmark_node_next(cmark_node *node);
202
+
203
+ /** Returns the previous node in the sequence after 'node', or NULL if
204
+ * there is none.
205
+ */
206
+ CMARK_EXPORT cmark_node *cmark_node_previous(cmark_node *node);
207
+
208
+ /** Returns the parent of 'node', or NULL if there is none.
209
+ */
210
+ CMARK_EXPORT cmark_node *cmark_node_parent(cmark_node *node);
211
+
212
+ /** Returns the first child of 'node', or NULL if 'node' has no children.
213
+ */
214
+ CMARK_EXPORT cmark_node *cmark_node_first_child(cmark_node *node);
215
+
216
+ /** Returns the last child of 'node', or NULL if 'node' has no children.
217
+ */
218
+ CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
219
+
220
+ /**
221
+ * ## Iterator
222
+ *
223
+ * An iterator will walk through a tree of nodes, starting from a root
224
+ * node, returning one node at a time, together with information about
225
+ * whether the node is being entered or exited. The iterator will
226
+ * first descend to a child node, if there is one. When there is no
227
+ * child, the iterator will go to the next sibling. When there is no
228
+ * next sibling, the iterator will return to the parent (but with
229
+ * a 'cmark_event_type' of `CMARK_EVENT_EXIT`). The iterator will
230
+ * return `CMARK_EVENT_DONE` when it reaches the root node again.
231
+ * One natural application is an HTML renderer, where an `ENTER` event
232
+ * outputs an open tag and an `EXIT` event outputs a close tag.
233
+ * An iterator might also be used to transform an AST in some systematic
234
+ * way, for example, turning all level-3 headings into regular paragraphs.
235
+ *
236
+ * void
237
+ * usage_example(cmark_node *root) {
238
+ * cmark_event_type ev_type;
239
+ * cmark_iter *iter = cmark_iter_new(root);
240
+ *
241
+ * while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
242
+ * cmark_node *cur = cmark_iter_get_node(iter);
243
+ * // Do something with `cur` and `ev_type`
244
+ * }
245
+ *
246
+ * cmark_iter_free(iter);
247
+ * }
248
+ *
249
+ * Iterators will never return `EXIT` events for leaf nodes, which are nodes
250
+ * of type:
251
+ *
252
+ * * CMARK_NODE_HTML_BLOCK
253
+ * * CMARK_NODE_THEMATIC_BREAK
254
+ * * CMARK_NODE_CODE_BLOCK
255
+ * * CMARK_NODE_TEXT
256
+ * * CMARK_NODE_SOFTBREAK
257
+ * * CMARK_NODE_LINEBREAK
258
+ * * CMARK_NODE_CODE
259
+ * * CMARK_NODE_HTML_INLINE
260
+ *
261
+ * Nodes must only be modified after an `EXIT` event, or an `ENTER` event for
262
+ * leaf nodes.
263
+ */
264
+
265
+ typedef enum {
266
+ CMARK_EVENT_NONE,
267
+ CMARK_EVENT_DONE,
268
+ CMARK_EVENT_ENTER,
269
+ CMARK_EVENT_EXIT
270
+ } cmark_event_type;
271
+
272
+ /** Creates a new iterator starting at 'root'. The current node and event
273
+ * type are undefined until 'cmark_iter_next' is called for the first time.
274
+ * The memory allocated for the iterator should be released using
275
+ * 'cmark_iter_free' when it is no longer needed.
276
+ */
277
+ CMARK_EXPORT
278
+ cmark_iter *cmark_iter_new(cmark_node *root);
279
+
280
+ /** Frees the memory allocated for an iterator.
281
+ */
282
+ CMARK_EXPORT
283
+ void cmark_iter_free(cmark_iter *iter);
284
+
285
+ /** Advances to the next node and returns the event type (`CMARK_EVENT_ENTER`,
286
+ * `CMARK_EVENT_EXIT` or `CMARK_EVENT_DONE`).
287
+ */
288
+ CMARK_EXPORT
289
+ cmark_event_type cmark_iter_next(cmark_iter *iter);
290
+
291
+ /** Returns the current node.
292
+ */
293
+ CMARK_EXPORT
294
+ cmark_node *cmark_iter_get_node(cmark_iter *iter);
295
+
296
+ /** Returns the current event type.
297
+ */
298
+ CMARK_EXPORT
299
+ cmark_event_type cmark_iter_get_event_type(cmark_iter *iter);
300
+
301
+ /** Returns the root node.
302
+ */
303
+ CMARK_EXPORT
304
+ cmark_node *cmark_iter_get_root(cmark_iter *iter);
305
+
306
+ /** Resets the iterator so that the current node is 'current' and
307
+ * the event type is 'event_type'. The new current node must be a
308
+ * descendant of the root node or the root node itself.
309
+ */
310
+ CMARK_EXPORT
311
+ void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
312
+ cmark_event_type event_type);
313
+
314
+ /**
315
+ * ## Accessors
316
+ */
317
+
318
+ /** Returns the user data of 'node'.
319
+ */
320
+ CMARK_EXPORT void *cmark_node_get_user_data(cmark_node *node);
321
+
322
+ /** Sets arbitrary user data for 'node'. Returns 1 on success,
323
+ * 0 on failure.
324
+ */
325
+ CMARK_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data);
326
+
327
+ /** Set free function for user data */
328
+ CMARK_EXPORT
329
+ int cmark_node_set_user_data_free_func(cmark_node *node,
330
+ cmark_free_func free_func);
331
+
332
+ /** Returns the type of 'node', or `CMARK_NODE_NONE` on error.
333
+ */
334
+ CMARK_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node);
335
+
336
+ /** Like 'cmark_node_get_type', but returns a string representation
337
+ of the type, or `"<unknown>"`.
338
+ */
339
+ CMARK_EXPORT
340
+ const char *cmark_node_get_type_string(cmark_node *node);
341
+
342
+ /** Returns the string contents of 'node', or an empty
343
+ string if none is set. Returns NULL if called on a
344
+ node that does not have string content.
345
+ */
346
+ CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node);
347
+
348
+ /** Sets the string contents of 'node'. Returns 1 on success,
349
+ * 0 on failure.
350
+ */
351
+ CMARK_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content);
352
+
353
+ /** Returns the heading level of 'node', or 0 if 'node' is not a heading.
354
+ */
355
+ CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node);
356
+
357
+ /* For backwards compatibility */
358
+ #define cmark_node_get_header_level cmark_node_get_heading_level
359
+ #define cmark_node_set_header_level cmark_node_set_heading_level
360
+
361
+ /** Sets the heading level of 'node', returning 1 on success and 0 on error.
362
+ */
363
+ CMARK_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level);
364
+
365
+ /** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node'
366
+ * is not a list.
367
+ */
368
+ CMARK_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node);
369
+
370
+ /** Sets the list type of 'node', returning 1 on success and 0 on error.
371
+ */
372
+ CMARK_EXPORT int cmark_node_set_list_type(cmark_node *node,
373
+ cmark_list_type type);
374
+
375
+ /** Returns the list delimiter type of 'node', or `CMARK_NO_DELIM` if 'node'
376
+ * is not a list.
377
+ */
378
+ CMARK_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node);
379
+
380
+ /** Sets the list delimiter type of 'node', returning 1 on success and 0
381
+ * on error.
382
+ */
383
+ CMARK_EXPORT int cmark_node_set_list_delim(cmark_node *node,
384
+ cmark_delim_type delim);
385
+
386
+ /** Returns starting number of 'node', if it is an ordered list, otherwise 0.
387
+ */
388
+ CMARK_EXPORT int cmark_node_get_list_start(cmark_node *node);
389
+
390
+ /** Sets starting number of 'node', if it is an ordered list. Returns 1
391
+ * on success, 0 on failure.
392
+ */
393
+ CMARK_EXPORT int cmark_node_set_list_start(cmark_node *node, int start);
394
+
395
+ /** Returns 1 if 'node' is a tight list, 0 otherwise.
396
+ */
397
+ CMARK_EXPORT int cmark_node_get_list_tight(cmark_node *node);
398
+
399
+ /** Sets the "tightness" of a list. Returns 1 on success, 0 on failure.
400
+ */
401
+ CMARK_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight);
402
+
403
+ /** Returns the info string from a fenced code block.
404
+ */
405
+ CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
406
+
407
+ /** Sets the info string in a fenced code block, returning 1 on
408
+ * success and 0 on failure.
409
+ */
410
+ CMARK_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info);
411
+
412
+ /** Sets code blocks fencing details
413
+ */
414
+ CMARK_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced,
415
+ int length, int offset, char character);
416
+
417
+ /** Returns code blocks fencing details
418
+ */
419
+ CMARK_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character);
420
+
421
+ /** Returns the URL of a link or image 'node', or an empty string
422
+ if no URL is set. Returns NULL if called on a node that is
423
+ not a link or image.
424
+ */
425
+ CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node);
426
+
427
+ /** Sets the URL of a link or image 'node'. Returns 1 on success,
428
+ * 0 on failure.
429
+ */
430
+ CMARK_EXPORT int cmark_node_set_url(cmark_node *node, const char *url);
431
+
432
+ /** Returns the title of a link or image 'node', or an empty
433
+ string if no title is set. Returns NULL if called on a node
434
+ that is not a link or image.
435
+ */
436
+ CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node);
437
+
438
+ /** Sets the title of a link or image 'node'. Returns 1 on success,
439
+ * 0 on failure.
440
+ */
441
+ CMARK_EXPORT int cmark_node_set_title(cmark_node *node, const char *title);
442
+
443
+ /** Returns the literal "on enter" text for a custom 'node', or
444
+ an empty string if no on_enter is set. Returns NULL if called
445
+ on a non-custom node.
446
+ */
447
+ CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
448
+
449
+ /** Sets the literal text to render "on enter" for a custom 'node'.
450
+ Any children of the node will be rendered after this text.
451
+ Returns 1 on success 0 on failure.
452
+ */
453
+ CMARK_EXPORT int cmark_node_set_on_enter(cmark_node *node,
454
+ const char *on_enter);
455
+
456
+ /** Returns the literal "on exit" text for a custom 'node', or
457
+ an empty string if no on_exit is set. Returns NULL if
458
+ called on a non-custom node.
459
+ */
460
+ CMARK_EXPORT const char *cmark_node_get_on_exit(cmark_node *node);
461
+
462
+ /** Sets the literal text to render "on exit" for a custom 'node'.
463
+ Any children of the node will be rendered before this text.
464
+ Returns 1 on success 0 on failure.
465
+ */
466
+ CMARK_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit);
467
+
468
+ /** Returns the line on which 'node' begins.
469
+ */
470
+ CMARK_EXPORT int cmark_node_get_start_line(cmark_node *node);
471
+
472
+ /** Returns the column at which 'node' begins.
473
+ */
474
+ CMARK_EXPORT int cmark_node_get_start_column(cmark_node *node);
475
+
476
+ /** Returns the line on which 'node' ends.
477
+ */
478
+ CMARK_EXPORT int cmark_node_get_end_line(cmark_node *node);
479
+
480
+ /** Returns the column at which 'node' ends.
481
+ */
482
+ CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node);
483
+
484
+ /**
485
+ * ## Tree Manipulation
486
+ */
487
+
488
+ /** Unlinks a 'node', removing it from the tree, but not freeing its
489
+ * memory. (Use 'cmark_node_free' for that.)
490
+ */
491
+ CMARK_EXPORT void cmark_node_unlink(cmark_node *node);
492
+
493
+ /** Inserts 'sibling' before 'node'. Returns 1 on success, 0 on failure.
494
+ */
495
+ CMARK_EXPORT int cmark_node_insert_before(cmark_node *node,
496
+ cmark_node *sibling);
497
+
498
+ /** Inserts 'sibling' after 'node'. Returns 1 on success, 0 on failure.
499
+ */
500
+ CMARK_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
501
+
502
+ /** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does
503
+ * not free its memory).
504
+ * Returns 1 on success, 0 on failure.
505
+ */
506
+ CMARK_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode);
507
+
508
+ /** Adds 'child' to the beginning of the children of 'node'.
509
+ * Returns 1 on success, 0 on failure.
510
+ */
511
+ CMARK_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child);
512
+
513
+ /** Adds 'child' to the end of the children of 'node'.
514
+ * Returns 1 on success, 0 on failure.
515
+ */
516
+ CMARK_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child);
517
+
518
+ /** Consolidates adjacent text nodes.
519
+ */
520
+ CMARK_EXPORT void cmark_consolidate_text_nodes(cmark_node *root);
521
+
522
+ /** Ensures a node and all its children own their own chunk memory.
523
+ */
524
+ CMARK_EXPORT void cmark_node_own(cmark_node *root);
525
+
526
+ /**
527
+ * ## Parsing
528
+ *
529
+ * Simple interface:
530
+ *
531
+ * cmark_node *document = cmark_parse_document("Hello *world*", 13,
532
+ * CMARK_OPT_DEFAULT);
533
+ *
534
+ * Streaming interface:
535
+ *
536
+ * cmark_parser *parser = cmark_parser_new(CMARK_OPT_DEFAULT);
537
+ * FILE *fp = fopen("myfile.md", "rb");
538
+ * while ((bytes = fread(buffer, 1, sizeof(buffer), fp)) > 0) {
539
+ * cmark_parser_feed(parser, buffer, bytes);
540
+ * if (bytes < sizeof(buffer)) {
541
+ * break;
542
+ * }
543
+ * }
544
+ * document = cmark_parser_finish(parser);
545
+ * cmark_parser_free(parser);
546
+ */
547
+
548
+ /** Creates a new parser object.
549
+ */
550
+ CMARK_EXPORT
551
+ cmark_parser *cmark_parser_new(int options);
552
+
553
+ /** Creates a new parser object with the given memory allocator
554
+ */
555
+ CMARK_EXPORT
556
+ cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem);
557
+
558
+ /** Frees memory allocated for a parser object.
559
+ */
560
+ CMARK_EXPORT
561
+ void cmark_parser_free(cmark_parser *parser);
562
+
563
+ /** Feeds a string of length 'len' to 'parser'.
564
+ */
565
+ CMARK_EXPORT
566
+ void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len);
567
+
568
+ /** Finish parsing and return a pointer to a tree of nodes.
569
+ */
570
+ CMARK_EXPORT
571
+ cmark_node *cmark_parser_finish(cmark_parser *parser);
572
+
573
+ /** Parse a CommonMark document in 'buffer' of length 'len'.
574
+ * Returns a pointer to a tree of nodes. The memory allocated for
575
+ * the node tree should be released using 'cmark_node_free'
576
+ * when it is no longer needed.
577
+ */
578
+ CMARK_EXPORT
579
+ cmark_node *cmark_parse_document(const char *buffer, size_t len, int options);
580
+
581
+ /** Parse a CommonMark document in file 'f', returning a pointer to
582
+ * a tree of nodes. The memory allocated for the node tree should be
583
+ * released using 'cmark_node_free' when it is no longer needed.
584
+ */
585
+ CMARK_EXPORT
586
+ cmark_node *cmark_parse_file(FILE *f, int options);
587
+
588
+ /**
589
+ * ## Rendering
590
+ */
591
+
592
+ /** Render a 'node' tree as XML. It is the caller's responsibility
593
+ * to free the returned buffer.
594
+ */
595
+ CMARK_EXPORT
596
+ char *cmark_render_xml(cmark_node *root, int options);
597
+
598
+ /** As for 'cmark_render_xml', but specifying the allocator to use for
599
+ * the resulting string.
600
+ */
601
+ CMARK_EXPORT
602
+ char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem);
603
+
604
+ /** Render a 'node' tree as an HTML fragment. It is up to the user
605
+ * to add an appropriate header and footer. It is the caller's
606
+ * responsibility to free the returned buffer.
607
+ */
608
+ CMARK_EXPORT
609
+ char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions);
610
+
611
+ /** As for 'cmark_render_html', but specifying the allocator to use for
612
+ * the resulting string.
613
+ */
614
+ CMARK_EXPORT
615
+ char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem);
616
+
617
+ /** Render a 'node' tree as a groff man page, without the header.
618
+ * It is the caller's responsibility to free the returned buffer.
619
+ */
620
+ CMARK_EXPORT
621
+ char *cmark_render_man(cmark_node *root, int options, int width);
622
+
623
+ /** As for 'cmark_render_man', but specifying the allocator to use for
624
+ * the resulting string.
625
+ */
626
+ CMARK_EXPORT
627
+ char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
628
+
629
+ /** Render a 'node' tree as a commonmark document.
630
+ * It is the caller's responsibility to free the returned buffer.
631
+ */
632
+ CMARK_EXPORT
633
+ char *cmark_render_commonmark(cmark_node *root, int options, int width);
634
+
635
+ /** As for 'cmark_render_commonmark', but specifying the allocator to use for
636
+ * the resulting string.
637
+ */
638
+ CMARK_EXPORT
639
+ char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
640
+
641
+ /** Render a 'node' tree as a plain text document.
642
+ * It is the caller's responsibility to free the returned buffer.
643
+ */
644
+ CMARK_EXPORT
645
+ char *cmark_render_plaintext(cmark_node *root, int options, int width);
646
+
647
+ /** As for 'cmark_render_plaintext', but specifying the allocator to use for
648
+ * the resulting string.
649
+ */
650
+ CMARK_EXPORT
651
+ char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
652
+
653
+ /** Render a 'node' tree as a LaTeX document.
654
+ * It is the caller's responsibility to free the returned buffer.
655
+ */
656
+ CMARK_EXPORT
657
+ char *cmark_render_latex(cmark_node *root, int options, int width);
658
+
659
+ /** As for 'cmark_render_latex', but specifying the allocator to use for
660
+ * the resulting string.
661
+ */
662
+ CMARK_EXPORT
663
+ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
664
+
665
+ /**
666
+ * ## Options
667
+ */
668
+
669
+ /** Default options.
670
+ */
671
+ #define CMARK_OPT_DEFAULT 0
672
+
673
+ /**
674
+ * ### Options affecting rendering
675
+ */
676
+
677
+ /** Include a `data-sourcepos` attribute on all block elements.
678
+ */
679
+ #define CMARK_OPT_SOURCEPOS (1 << 1)
680
+
681
+ /** Render `softbreak` elements as hard line breaks.
682
+ */
683
+ #define CMARK_OPT_HARDBREAKS (1 << 2)
684
+
685
+ /** Suppress raw HTML and unsafe links (`javascript:`, `vbscript:`,
686
+ * `file:`, and `data:`, except for `image/png`, `image/gif`,
687
+ * `image/jpeg`, or `image/webp` mime types). Raw HTML is replaced
688
+ * by a placeholder HTML comment. Unsafe links are replaced by
689
+ * empty strings.
690
+ */
691
+ #define CMARK_OPT_SAFE (1 << 3)
692
+
693
+ /** Render `softbreak` elements as spaces.
694
+ */
695
+ #define CMARK_OPT_NOBREAKS (1 << 4)
696
+
697
+ /**
698
+ * ### Options affecting parsing
699
+ */
700
+
701
+ /** Legacy option (no effect).
702
+ */
703
+ #define CMARK_OPT_NORMALIZE (1 << 8)
704
+
705
+ /** Validate UTF-8 in the input before parsing, replacing illegal
706
+ * sequences with the replacement character U+FFFD.
707
+ */
708
+ #define CMARK_OPT_VALIDATE_UTF8 (1 << 9)
709
+
710
+ /** Convert straight quotes to curly, --- to em dashes, -- to en dashes.
711
+ */
712
+ #define CMARK_OPT_SMART (1 << 10)
713
+
714
+ /** Use GitHub-style <pre lang="x"> tags for code blocks instead of <pre><code
715
+ * class="language-x">.
716
+ */
717
+ #define CMARK_OPT_GITHUB_PRE_LANG (1 << 11)
718
+
719
+ /** Be liberal in interpreting inline HTML tags.
720
+ */
721
+ #define CMARK_OPT_LIBERAL_HTML_TAG (1 << 12)
722
+
723
+ /** Parse footnotes.
724
+ */
725
+ #define CMARK_OPT_FOOTNOTES (1 << 13)
726
+
727
+ /**
728
+ * ## Version information
729
+ */
730
+
731
+ /** The library version as integer for runtime checks. Also available as
732
+ * macro CMARK_VERSION for compile time checks.
733
+ *
734
+ * * Bits 16-23 contain the major version.
735
+ * * Bits 8-15 contain the minor version.
736
+ * * Bits 0-7 contain the patchlevel.
737
+ *
738
+ * In hexadecimal format, the number 0x010203 represents version 1.2.3.
739
+ */
740
+ CMARK_EXPORT
741
+ int cmark_version(void);
742
+
743
+ /** The library version string for runtime checks. Also available as
744
+ * macro CMARK_VERSION_STRING for compile time checks.
745
+ */
746
+ CMARK_EXPORT
747
+ const char *cmark_version_string(void);
748
+
749
+ /** # AUTHORS
750
+ *
751
+ * John MacFarlane, Vicent Marti, Kārlis Gaņģis, Nick Wellnhofer.
752
+ */
753
+
754
+ #ifndef CMARK_NO_SHORT_NAMES
755
+ #define NODE_DOCUMENT CMARK_NODE_DOCUMENT
756
+ #define NODE_BLOCK_QUOTE CMARK_NODE_BLOCK_QUOTE
757
+ #define NODE_LIST CMARK_NODE_LIST
758
+ #define NODE_ITEM CMARK_NODE_ITEM
759
+ #define NODE_CODE_BLOCK CMARK_NODE_CODE_BLOCK
760
+ #define NODE_HTML_BLOCK CMARK_NODE_HTML_BLOCK
761
+ #define NODE_CUSTOM_BLOCK CMARK_NODE_CUSTOM_BLOCK
762
+ #define NODE_PARAGRAPH CMARK_NODE_PARAGRAPH
763
+ #define NODE_HEADING CMARK_NODE_HEADING
764
+ #define NODE_HEADER CMARK_NODE_HEADER
765
+ #define NODE_THEMATIC_BREAK CMARK_NODE_THEMATIC_BREAK
766
+ #define NODE_HRULE CMARK_NODE_HRULE
767
+ #define NODE_TEXT CMARK_NODE_TEXT
768
+ #define NODE_SOFTBREAK CMARK_NODE_SOFTBREAK
769
+ #define NODE_LINEBREAK CMARK_NODE_LINEBREAK
770
+ #define NODE_CODE CMARK_NODE_CODE
771
+ #define NODE_HTML_INLINE CMARK_NODE_HTML_INLINE
772
+ #define NODE_CUSTOM_INLINE CMARK_NODE_CUSTOM_INLINE
773
+ #define NODE_EMPH CMARK_NODE_EMPH
774
+ #define NODE_STRONG CMARK_NODE_STRONG
775
+ #define NODE_LINK CMARK_NODE_LINK
776
+ #define NODE_IMAGE CMARK_NODE_IMAGE
777
+ #define BULLET_LIST CMARK_BULLET_LIST
778
+ #define ORDERED_LIST CMARK_ORDERED_LIST
779
+ #define PERIOD_DELIM CMARK_PERIOD_DELIM
780
+ #define PAREN_DELIM CMARK_PAREN_DELIM
781
+ #endif
782
+
783
+ typedef int32_t bufsize_t;
784
+
785
+ #ifdef __cplusplus
786
+ }
787
+ #endif
788
+
789
+ #endif