commonmarker 0.17.5 → 0.17.6

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 (199) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/ext/commonmarker/cmark/CMakeLists.txt +1 -1
  4. data/ext/commonmarker/cmark/README.md +3 -2
  5. data/ext/commonmarker/cmark/api_test/CMakeLists.txt +1 -1
  6. data/ext/commonmarker/cmark/api_test/main.c +91 -0
  7. data/ext/commonmarker/cmark/changelog.txt +24 -1
  8. data/ext/commonmarker/cmark/extensions/core-extensions.c +1 -0
  9. data/ext/commonmarker/cmark/extensions/core-extensions.h +1 -0
  10. data/ext/commonmarker/cmark/extensions/strikethrough.c +2 -1
  11. data/ext/commonmarker/cmark/extensions/table.c +1 -0
  12. data/ext/commonmarker/cmark/man/man3/cmark-gfm.3 +41 -1
  13. data/ext/commonmarker/cmark/src/CMakeLists.txt +12 -4
  14. data/ext/commonmarker/cmark/src/blocks.c +115 -3
  15. data/ext/commonmarker/cmark/src/buffer.h +0 -2
  16. data/ext/commonmarker/cmark/src/chunk.h +1 -1
  17. data/ext/commonmarker/cmark/src/cmark.c +2 -2
  18. data/ext/commonmarker/cmark/src/cmark.h +9 -0
  19. data/ext/commonmarker/cmark/src/cmark_extension_api.h +9 -7
  20. data/ext/commonmarker/cmark/src/commonmark.c +23 -0
  21. data/ext/commonmarker/cmark/src/footnotes.c +40 -0
  22. data/ext/commonmarker/cmark/src/footnotes.h +25 -0
  23. data/ext/commonmarker/cmark/src/html.c +56 -1
  24. data/ext/commonmarker/cmark/src/inlines.c +46 -25
  25. data/ext/commonmarker/cmark/src/inlines.h +2 -2
  26. data/ext/commonmarker/cmark/src/latex.c +5 -0
  27. data/ext/commonmarker/cmark/src/libcmark-gfm.pc.in +1 -1
  28. data/ext/commonmarker/cmark/src/main.c +3 -0
  29. data/ext/commonmarker/cmark/src/man.c +5 -0
  30. data/ext/commonmarker/cmark/src/map.c +122 -0
  31. data/ext/commonmarker/cmark/src/map.h +42 -0
  32. data/ext/commonmarker/cmark/src/node.c +5 -0
  33. data/ext/commonmarker/cmark/src/parser.h +1 -1
  34. data/ext/commonmarker/cmark/src/plaintext.c +1 -0
  35. data/ext/commonmarker/cmark/src/references.c +11 -125
  36. data/ext/commonmarker/cmark/src/references.h +5 -20
  37. data/ext/commonmarker/cmark/src/render.c +2 -1
  38. data/ext/commonmarker/cmark/src/render.h +3 -0
  39. data/ext/commonmarker/cmark/src/scanners.c +168 -32
  40. data/ext/commonmarker/cmark/src/scanners.h +2 -0
  41. data/ext/commonmarker/cmark/src/scanners.re +10 -0
  42. data/ext/commonmarker/cmark/src/syntax_extension.c +3 -2
  43. data/ext/commonmarker/cmark/src/syntax_extension.h +1 -0
  44. data/ext/commonmarker/cmark/test/CMakeLists.txt +7 -2
  45. data/ext/commonmarker/cmark/test/extensions.txt +59 -0
  46. data/ext/commonmarker/cmark/test/pathological_tests.py +21 -3
  47. data/ext/commonmarker/cmark/wrappers/wrapper.js +6 -0
  48. data/ext/commonmarker/commonmarker.c +14 -0
  49. data/lib/commonmarker/config.rb +1 -0
  50. data/lib/commonmarker/renderer/html_renderer.rb +41 -0
  51. data/lib/commonmarker/version.rb +1 -1
  52. data/test/test_footnotes.rb +25 -0
  53. metadata +9 -148
  54. data/ext/commonmarker/cmark/build/CMakeCache.txt +0 -481
  55. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CMakeCCompiler.cmake +0 -68
  56. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CMakeCXXCompiler.cmake +0 -70
  57. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_C.bin +0 -0
  58. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CMakeDetermineCompilerABI_CXX.bin +0 -0
  59. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CMakeSystem.cmake +0 -15
  60. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CompilerIdC/CMakeCCompilerId.c +0 -567
  61. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CompilerIdC/a.out +0 -0
  62. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -539
  63. data/ext/commonmarker/cmark/build/CMakeFiles/3.8.2/CompilerIdCXX/a.out +0 -0
  64. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CMakeCCompiler.cmake +0 -71
  65. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CMakeCXXCompiler.cmake +0 -73
  66. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CMakeDetermineCompilerABI_C.bin +0 -0
  67. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
  68. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CMakeSystem.cmake +0 -15
  69. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CompilerIdC/CMakeCCompilerId.c +0 -567
  70. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CompilerIdC/a.out +0 -0
  71. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -539
  72. data/ext/commonmarker/cmark/build/CMakeFiles/3.9.4/CompilerIdCXX/a.out +0 -0
  73. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  74. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log +0 -14
  75. data/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log +0 -1169
  76. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile.cmake +0 -155
  77. data/ext/commonmarker/cmark/build/CMakeFiles/Makefile2 +0 -391
  78. data/ext/commonmarker/cmark/build/CMakeFiles/TargetDirectories.txt +0 -48
  79. data/ext/commonmarker/cmark/build/CMakeFiles/cmake.check_cache +0 -1
  80. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.bin +0 -0
  81. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.c +0 -34
  82. data/ext/commonmarker/cmark/build/CMakeFiles/feature_tests.cxx +0 -405
  83. data/ext/commonmarker/cmark/build/CMakeFiles/progress.marks +0 -1
  84. data/ext/commonmarker/cmark/build/CTestTestfile.cmake +0 -11
  85. data/ext/commonmarker/cmark/build/Makefile +0 -280
  86. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  87. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/DependInfo.cmake +0 -38
  88. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/build.make +0 -169
  89. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/cmake_clean.cmake +0 -12
  90. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/depend.make +0 -2
  91. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/flags.make +0 -17
  92. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/link.txt +0 -1
  93. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/api_test.dir/progress.make +0 -5
  94. data/ext/commonmarker/cmark/build/api_test/CMakeFiles/progress.marks +0 -1
  95. data/ext/commonmarker/cmark/build/api_test/Makefile +0 -302
  96. data/ext/commonmarker/cmark/build/api_test/cmake_install.cmake +0 -29
  97. data/ext/commonmarker/cmark/build/cmake_install.cmake +0 -49
  98. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  99. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions-release.cmake +0 -30
  100. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/Export/lib/cmake-gfmextensions/cmark-gfmextensions.cmake +0 -108
  101. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/DependInfo.cmake +0 -36
  102. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/build.make +0 -253
  103. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/cmake_clean.cmake +0 -16
  104. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/depend.make +0 -2
  105. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/flags.make +0 -10
  106. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/link.txt +0 -1
  107. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions.dir/progress.make +0 -8
  108. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/C.includecache +0 -236
  109. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/DependInfo.cmake +0 -29
  110. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/autolink.c.o +0 -0
  111. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/build.make +0 -249
  112. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean.cmake +0 -15
  113. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/cmake_clean_target.cmake +0 -3
  114. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/core-extensions.c.o +0 -0
  115. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.internal +0 -102
  116. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/depend.make +0 -102
  117. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/ext_scanners.c.o +0 -0
  118. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/flags.make +0 -10
  119. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/link.txt +0 -2
  120. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/progress.make +0 -8
  121. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/strikethrough.c.o +0 -0
  122. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/table.c.o +0 -0
  123. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/libcmark-gfmextensions_static.dir/tagfilter.c.o +0 -0
  124. data/ext/commonmarker/cmark/build/extensions/CMakeFiles/progress.marks +0 -1
  125. data/ext/commonmarker/cmark/build/extensions/Makefile +0 -426
  126. data/ext/commonmarker/cmark/build/extensions/cmake_install.cmake +0 -84
  127. data/ext/commonmarker/cmark/build/extensions/cmarkextensions_export.h +0 -42
  128. data/ext/commonmarker/cmark/build/extensions/libcmark-gfmextensions.a +0 -0
  129. data/ext/commonmarker/cmark/build/man/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  130. data/ext/commonmarker/cmark/build/man/CMakeFiles/progress.marks +0 -1
  131. data/ext/commonmarker/cmark/build/man/Makefile +0 -196
  132. data/ext/commonmarker/cmark/build/man/cmake_install.cmake +0 -37
  133. data/ext/commonmarker/cmark/build/src/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  134. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake-gfm/cmark-gfm-release.cmake +0 -38
  135. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake-gfm/cmark-gfm.cmake +0 -95
  136. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark-release.cmake +0 -38
  137. data/ext/commonmarker/cmark/build/src/CMakeFiles/Export/lib/cmake/cmark.cmake +0 -95
  138. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/DependInfo.cmake +0 -30
  139. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/build.make +0 -115
  140. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/cmake_clean.cmake +0 -10
  141. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/depend.make +0 -2
  142. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/flags.make +0 -10
  143. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/link.txt +0 -1
  144. data/ext/commonmarker/cmark/build/src/CMakeFiles/cmark-gfm.dir/progress.make +0 -3
  145. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/DependInfo.cmake +0 -58
  146. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/build.make +0 -765
  147. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/cmake_clean.cmake +0 -35
  148. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/depend.make +0 -2
  149. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/flags.make +0 -10
  150. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/link.txt +0 -1
  151. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm.dir/progress.make +0 -27
  152. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/C.includecache +0 -624
  153. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/DependInfo.cmake +0 -52
  154. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/arena.c.o +0 -0
  155. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/blocks.c.o +0 -0
  156. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/buffer.c.o +0 -0
  157. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/build.make +0 -762
  158. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean.cmake +0 -34
  159. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmake_clean_target.cmake +0 -3
  160. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark.c.o +0 -0
  161. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/cmark_ctype.c.o +0 -0
  162. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/commonmark.c.o +0 -0
  163. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.internal +0 -310
  164. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/depend.make +0 -310
  165. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/flags.make +0 -10
  166. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_href_e.c.o +0 -0
  167. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_e.c.o +0 -0
  168. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/houdini_html_u.c.o +0 -0
  169. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/html.c.o +0 -0
  170. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/inlines.c.o +0 -0
  171. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/iterator.c.o +0 -0
  172. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/latex.c.o +0 -0
  173. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/link.txt +0 -2
  174. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/linked_list.c.o +0 -0
  175. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/man.c.o +0 -0
  176. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/node.c.o +0 -0
  177. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plaintext.c.o +0 -0
  178. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/plugin.c.o +0 -0
  179. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/progress.make +0 -27
  180. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/references.c.o +0 -0
  181. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/registry.c.o +0 -0
  182. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/render.c.o +0 -0
  183. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/scanners.c.o +0 -0
  184. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/syntax_extension.c.o +0 -0
  185. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/utf8.c.o +0 -0
  186. data/ext/commonmarker/cmark/build/src/CMakeFiles/libcmark-gfm_static.dir/xml.c.o +0 -0
  187. data/ext/commonmarker/cmark/build/src/CMakeFiles/progress.marks +0 -1
  188. data/ext/commonmarker/cmark/build/src/Makefile +0 -1099
  189. data/ext/commonmarker/cmark/build/src/cmake_install.cmake +0 -97
  190. data/ext/commonmarker/cmark/build/src/cmark_export.h +0 -42
  191. data/ext/commonmarker/cmark/build/src/cmark_version.h +0 -8
  192. data/ext/commonmarker/cmark/build/src/config.h +0 -76
  193. data/ext/commonmarker/cmark/build/src/libcmark-gfm.a +0 -0
  194. data/ext/commonmarker/cmark/build/src/libcmark-gfm.pc +0 -10
  195. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/CMakeDirectoryInformation.cmake +0 -16
  196. data/ext/commonmarker/cmark/build/testdir/CMakeFiles/progress.marks +0 -1
  197. data/ext/commonmarker/cmark/build/testdir/CTestTestfile.cmake +0 -17
  198. data/ext/commonmarker/cmark/build/testdir/Makefile +0 -196
  199. data/ext/commonmarker/cmark/build/testdir/cmake_install.cmake +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4e7274f40d6711782c78b1bc37386aa100bd8cd
4
- data.tar.gz: 7282e60be23d6a3639b39ae141db93a139ef8877
3
+ metadata.gz: 59c20d40eba9c5219f78e92f0741d8fb2d9f29da
4
+ data.tar.gz: 44156b81161f96642c89cddc2f416589a85be867
5
5
  SHA512:
6
- metadata.gz: 8cf250dc6f362023b915fa34a60a09488ec010a43afe8ce7c1b1cfa2c215a430a4bd484f296afcb989b38dfec4abbc64f554e66f8898304df9b0d83365863fa4
7
- data.tar.gz: 323c1b64b5edff338fa02661d06ecdcb508306d866be0d6412c1503e321439aa3648c6ee8cc6ba1fb733af33c960798c50d2c293ff13e8e2827aa20c02849ed0
6
+ metadata.gz: d7e13f4d09487c68da35dc9aeeb0cbdd3806191411d9c155acfac088f96c5cdc9790019f037a771836a4cab533aa83c04b334ca3c6e5baef2daedd6681f0d71c
7
+ data.tar.gz: 1560c72e0bc98a990563409c6178993b1d2807ce5817a1552a88436b3242de2badbf8991e05222614737fa3b922e35d70ee85ef136cec1fcc5f946d4a9a5fb7b
data/README.md CHANGED
@@ -135,6 +135,7 @@ CommonMarker accepts the same options that CMark does, as symbols. Note that the
135
135
  | `:SMART` | Use smart punctuation (curly quotes, etc.).
136
136
  | `:VALIDATE_UTF8` | Replace illegal sequences with the replacement character `U+FFFD`.
137
137
  | `:LIBERAL_HTML_TAG` | Support liberal parsing of inline HTML tags.
138
+ | `:FOOTNOTES` | Parse footnotes.
138
139
 
139
140
  ### Render options
140
141
 
@@ -18,7 +18,7 @@ set(PROJECT_NAME "cmark")
18
18
 
19
19
  set(PROJECT_VERSION_MAJOR 0)
20
20
  set(PROJECT_VERSION_MINOR 28)
21
- set(PROJECT_VERSION_PATCH 0)
21
+ set(PROJECT_VERSION_PATCH 3)
22
22
  set(PROJECT_VERSION_GFM 11)
23
23
  set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM} )
24
24
 
@@ -65,8 +65,9 @@ There are also libraries that wrap `libcmark` for
65
65
  [Lua](https://github.com/jgm/cmark-lua),
66
66
  [Perl](https://metacpan.org/release/CommonMark),
67
67
  [Python](https://pypi.python.org/pypi/paka.cmark),
68
- [R](https://cran.r-project.org/package=commonmark) and
69
- [Scala](https://github.com/sparsetech/cmark-scala).
68
+ [R](https://cran.r-project.org/package=commonmark),
69
+ [Scala](https://github.com/sparsetech/cmark-scala) and
70
+ [Node.js](https://github.com/killa123/node-cmark).
70
71
 
71
72
  Installing
72
73
  ----------
@@ -22,5 +22,5 @@ if(MSVC)
22
22
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4706 /D_CRT_SECURE_NO_WARNINGS")
23
23
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
24
24
  elseif(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
25
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic")
25
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99 -pedantic -D_BSD_SOURCE -D_POSIX_SOURCE")
26
26
  endif()
@@ -989,6 +989,95 @@ static void test_pathological_regressions(test_batch_runner *runner) {
989
989
  }
990
990
  }
991
991
 
992
+ static void source_pos(test_batch_runner *runner) {
993
+ static const char markdown[] =
994
+ "# Hi *there*.\n"
995
+ "\n"
996
+ "Hello &ldquo; <http://www.google.com>\n"
997
+ "there `hi` -- [okay](www.google.com (ok)).\n"
998
+ "\n"
999
+ "> 1. Okay.\n"
1000
+ "> Sure.\n"
1001
+ ">\n"
1002
+ "> 2. Yes, okay.\n"
1003
+ "> ![ok](hi \"yes\")\n";
1004
+
1005
+ cmark_node *doc = cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT);
1006
+ char *xml = cmark_render_xml(doc, CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS);
1007
+ STR_EQ(runner, xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1008
+ "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
1009
+ "<document sourcepos=\"1:1-10:20\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
1010
+ " <heading sourcepos=\"1:1-1:13\" level=\"1\">\n"
1011
+ " <text sourcepos=\"1:3-1:5\">Hi </text>\n"
1012
+ " <emph sourcepos=\"1:6-1:12\">\n"
1013
+ " <text sourcepos=\"1:7-1:11\">there</text>\n"
1014
+ " </emph>\n"
1015
+ " <text sourcepos=\"1:13-1:13\">.</text>\n"
1016
+ " </heading>\n"
1017
+ " <paragraph sourcepos=\"3:1-4:42\">\n"
1018
+ " <text sourcepos=\"3:1-3:14\">Hello “ </text>\n"
1019
+ " <link sourcepos=\"3:15-3:37\" destination=\"http://www.google.com\" title=\"\">\n"
1020
+ " <text sourcepos=\"3:16-3:36\">http://www.google.com</text>\n"
1021
+ " </link>\n"
1022
+ " <softbreak />\n"
1023
+ " <text sourcepos=\"4:1-4:6\">there </text>\n"
1024
+ " <code sourcepos=\"4:8-4:9\">hi</code>\n"
1025
+ " <text sourcepos=\"4:11-4:14\"> -- </text>\n"
1026
+ " <link sourcepos=\"4:15-4:41\" destination=\"www.google.com\" title=\"ok\">\n"
1027
+ " <text sourcepos=\"4:16-4:19\">okay</text>\n"
1028
+ " </link>\n"
1029
+ " <text sourcepos=\"4:42-4:42\">.</text>\n"
1030
+ " </paragraph>\n"
1031
+ " <block_quote sourcepos=\"6:1-10:20\">\n"
1032
+ " <list sourcepos=\"6:3-10:20\" type=\"ordered\" start=\"1\" delim=\"period\" tight=\"false\">\n"
1033
+ " <item sourcepos=\"6:3-8:1\">\n"
1034
+ " <paragraph sourcepos=\"6:6-7:10\">\n"
1035
+ " <text sourcepos=\"6:6-6:10\">Okay.</text>\n"
1036
+ " <softbreak />\n"
1037
+ " <text sourcepos=\"7:6-7:10\">Sure.</text>\n"
1038
+ " </paragraph>\n"
1039
+ " </item>\n"
1040
+ " <item sourcepos=\"9:3-10:20\">\n"
1041
+ " <paragraph sourcepos=\"9:6-10:20\">\n"
1042
+ " <text sourcepos=\"9:6-9:15\">Yes, okay.</text>\n"
1043
+ " <softbreak />\n"
1044
+ " <image sourcepos=\"10:6-10:20\" destination=\"hi\" title=\"yes\">\n"
1045
+ " <text sourcepos=\"10:8-10:9\">ok</text>\n"
1046
+ " </image>\n"
1047
+ " </paragraph>\n"
1048
+ " </item>\n"
1049
+ " </list>\n"
1050
+ " </block_quote>\n"
1051
+ "</document>\n",
1052
+ "sourcepos are as expected");
1053
+ free(xml);
1054
+ cmark_node_free(doc);
1055
+ }
1056
+
1057
+ static void ref_source_pos(test_batch_runner *runner) {
1058
+ static const char markdown[] =
1059
+ "Let's try [reference] links.\n"
1060
+ "\n"
1061
+ "[reference]: https://github.com (GitHub)\n";
1062
+
1063
+ cmark_node *doc = cmark_parse_document(markdown, sizeof(markdown) - 1, CMARK_OPT_DEFAULT);
1064
+ char *xml = cmark_render_xml(doc, CMARK_OPT_DEFAULT | CMARK_OPT_SOURCEPOS);
1065
+ STR_EQ(runner, xml, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1066
+ "<!DOCTYPE document SYSTEM \"CommonMark.dtd\">\n"
1067
+ "<document sourcepos=\"1:1-3:40\" xmlns=\"http://commonmark.org/xml/1.0\">\n"
1068
+ " <paragraph sourcepos=\"1:1-1:28\">\n"
1069
+ " <text sourcepos=\"1:1-1:10\">Let's try </text>\n"
1070
+ " <link sourcepos=\"1:11-1:21\" destination=\"https://github.com\" title=\"GitHub\">\n"
1071
+ " <text sourcepos=\"1:12-1:20\">reference</text>\n"
1072
+ " </link>\n"
1073
+ " <text sourcepos=\"1:22-1:28\"> links.</text>\n"
1074
+ " </paragraph>\n"
1075
+ "</document>\n",
1076
+ "sourcepos are as expected");
1077
+ free(xml);
1078
+ cmark_node_free(doc);
1079
+ }
1080
+
992
1081
  int main() {
993
1082
  int retval;
994
1083
  test_batch_runner *runner = test_batch_runner_new();
@@ -1016,6 +1105,8 @@ int main() {
1016
1105
  test_safe(runner);
1017
1106
  test_feed_across_line_ending(runner);
1018
1107
  test_pathological_regressions(runner);
1108
+ source_pos(runner);
1109
+ ref_source_pos(runner);
1019
1110
 
1020
1111
  test_print_summary(runner);
1021
1112
  retval = test_ok(runner) ? 0 : 1;
@@ -1,3 +1,26 @@
1
+ [0.28.3]
2
+
3
+ * Include GNUInstallDirs in src/CMakeLists.txt (Nick Wellnhofer, #240).
4
+ This fixes build problems on some cmake versions (#241).
5
+
6
+ [0.28.2]
7
+
8
+ * Fixed regression in install dest for static library (#238).
9
+ Due to a mistake, 0.28.1 installed libcmark.a into include/.
10
+
11
+ [0.28.1]
12
+
13
+ * `--smart`: open quote can never occur right after `]` or `)` (#227).
14
+ * Fix quadratic behavior in `finalize` (Vicent Marti).
15
+ * Don't use `CMAKE_INSTALL_LIBDIR` to create `libcmark.pc` (#236).
16
+ This wasn't getting set in processing `libcmark.pc.in`, and we
17
+ were getting the wrong entry in `libcmark.pc`.
18
+ The new approach sets an internal `libdir` variable to
19
+ `lib${LIB_SUFFIX}`. This variable is used both to set the
20
+ install destination and in the libcmark.pc.in template.
21
+ * Update README.md, replace `make astyle` with `make format`
22
+ (Nguyễn Thái Ngọc Duy).
23
+
1
24
  [0.28.0.gfm.11]
2
25
 
3
26
  * Do not output empty `<tbody>` in table extension.
@@ -32,7 +55,7 @@
32
55
  * Add `core_extensions_ensure_registered`.
33
56
  * Add sourcepos information for inlines.
34
57
 
35
- [0.28]
58
+ [0.28.0]
36
59
 
37
60
  * Update spec.
38
61
  * Use unsigned integer when shifting (Phil Turnbull).
@@ -4,6 +4,7 @@
4
4
  #include "table.h"
5
5
  #include "tagfilter.h"
6
6
  #include "registry.h"
7
+ #include "plugin.h"
7
8
 
8
9
  static int core_extensions_registration(cmark_plugin *plugin) {
9
10
  cmark_plugin_register_syntax_extension(plugin, create_table_extension());
@@ -7,6 +7,7 @@ extern "C" {
7
7
 
8
8
  #include <cmark_extension_api.h>
9
9
  #include "cmarkextensions_export.h"
10
+ #include <stdint.h>
10
11
 
11
12
  CMARKEXTENSIONS_EXPORT
12
13
  void core_extensions_ensure_registered(void);
@@ -1,5 +1,6 @@
1
1
  #include "strikethrough.h"
2
2
  #include <parser.h>
3
+ #include <render.h>
3
4
 
4
5
  cmark_node_type CMARK_NODE_STRIKETHROUGH;
5
6
 
@@ -150,7 +151,7 @@ cmark_syntax_extension *create_strikethrough_extension(void) {
150
151
  special_chars = cmark_llist_append(mem, special_chars, (void *)'~');
151
152
  cmark_syntax_extension_set_special_inline_chars(ext, special_chars);
152
153
 
153
- cmark_syntax_extension_set_emphasis(ext, true);
154
+ cmark_syntax_extension_set_emphasis(ext, 1);
154
155
 
155
156
  return ext;
156
157
  }
@@ -4,6 +4,7 @@
4
4
  #include <parser.h>
5
5
  #include <references.h>
6
6
  #include <string.h>
7
+ #include <render.h>
7
8
 
8
9
  #include "ext_scanners.h"
9
10
  #include "strikethrough.h"
@@ -1,4 +1,4 @@
1
- .TH cmark-gfm 3 "April 03, 2017" "LOCAL" "Library Functions Manual"
1
+ .TH cmark-gfm 3 "November 09, 2017" "LOCAL" "Library Functions Manual"
2
2
  .SH
3
3
  NAME
4
4
  .PP
@@ -40,6 +40,7 @@ typedef enum {
40
40
  CMARK_NODE_PARAGRAPH = CMARK_NODE_TYPE_BLOCK | 0x0008,
41
41
  CMARK_NODE_HEADING = CMARK_NODE_TYPE_BLOCK | 0x0009,
42
42
  CMARK_NODE_THEMATIC_BREAK = CMARK_NODE_TYPE_BLOCK | 0x000a,
43
+ CMARK_NODE_FOOTNOTE_DEFINITION = CMARK_NODE_TYPE_BLOCK | 0x000b,
43
44
 
44
45
  /* Inline */
45
46
  CMARK_NODE_TEXT = CMARK_NODE_TYPE_INLINE | 0x0001,
@@ -52,6 +53,7 @@ typedef enum {
52
53
  CMARK_NODE_STRONG = CMARK_NODE_TYPE_INLINE | 0x0008,
53
54
  CMARK_NODE_LINK = CMARK_NODE_TYPE_INLINE | 0x0009,
54
55
  CMARK_NODE_IMAGE = CMARK_NODE_TYPE_INLINE | 0x000a,
56
+ CMARK_NODE_FOOTNOTE_REFERENCE = CMARK_NODE_TYPE_INLINE | 0x000b,
55
57
  } cmark_node_type;
56
58
  .RE
57
59
  \f[]
@@ -780,6 +782,20 @@ responsibility to free the returned buffer.
780
782
  As for \f[I]cmark_render_commonmark\f[], but specifying the allocator to
781
783
  use for the resulting string.
782
784
 
785
+ .PP
786
+ \fIchar *\f[] \fBcmark_render_plaintext\f[](\fIcmark_node *root\f[], \fIint options\f[], \fIint width\f[])
787
+
788
+ .PP
789
+ Render a \f[I]node\f[] tree as a plain text document. It is the caller's
790
+ responsibility to free the returned buffer.
791
+
792
+ .PP
793
+ \fIchar *\f[] \fBcmark_render_plaintext_with_mem\f[](\fIcmark_node *root\f[], \fIint options\f[], \fIint width\f[], \fIcmark_mem *mem\f[])
794
+
795
+ .PP
796
+ As for \f[I]cmark_render_plaintext\f[], but specifying the allocator to
797
+ use for the resulting string.
798
+
783
799
  .PP
784
800
  \fIchar *\f[] \fBcmark_render_latex\f[](\fIcmark_node *root\f[], \fIint options\f[], \fIint width\f[])
785
801
 
@@ -917,6 +933,30 @@ dashes.
917
933
  .PP
918
934
  Use GitHub\-style tags for code blocks instead of .
919
935
 
936
+ .PP
937
+ .nf
938
+ \fC
939
+ .RS 0n
940
+ #define CMARK_OPT_LIBERAL_HTML_TAG (1 << 12)
941
+ .RE
942
+ \f[]
943
+ .fi
944
+
945
+ .PP
946
+ Be liberal in interpreting inline HTML tags.
947
+
948
+ .PP
949
+ .nf
950
+ \fC
951
+ .RS 0n
952
+ #define CMARK_OPT_FOOTNOTES (1 << 13)
953
+ .RE
954
+ \f[]
955
+ .fi
956
+
957
+ .PP
958
+ Parse footnotes.
959
+
920
960
  .SS
921
961
  Version information
922
962
 
@@ -2,6 +2,8 @@ if(${CMAKE_VERSION} VERSION_GREATER "3.3")
2
2
  cmake_policy(SET CMP0063 NEW)
3
3
  endif()
4
4
 
5
+ include(GNUInstallDirs)
6
+
5
7
  set(LIBRARY "libcmark-gfm")
6
8
  set(STATICLIBRARY "libcmark-gfm_static")
7
9
  set(HEADERS
@@ -13,6 +15,8 @@ set(HEADERS
13
15
  iterator.h
14
16
  chunk.h
15
17
  references.h
18
+ footnotes.h
19
+ map.h
16
20
  utf8.h
17
21
  scanners.h
18
22
  inlines.h
@@ -34,6 +38,8 @@ set(LIBRARY_SOURCES
34
38
  utf8.c
35
39
  buffer.c
36
40
  references.c
41
+ footnotes.c
42
+ map.c
37
43
  render.c
38
44
  man.c
39
45
  xml.c
@@ -139,19 +145,21 @@ endif(MSVC)
139
145
 
140
146
  set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
141
147
 
148
+ set(libdir lib${LIB_SUFFIX})
149
+
142
150
  include (InstallRequiredSystemLibraries)
143
151
  install(TARGETS ${PROGRAM} ${CMARK_INSTALL}
144
152
  EXPORT cmark-gfm
145
153
  RUNTIME DESTINATION bin
146
- LIBRARY DESTINATION lib${LIB_SUFFIX}
147
- ARCHIVE DESTINATION lib${LIB_SUFFIX}
154
+ LIBRARY DESTINATION ${libdir}
155
+ ARCHIVE DESTINATION ${libdir}
148
156
  )
149
157
 
150
158
  if(CMARK_SHARED OR CMARK_STATIC)
151
159
  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libcmark-gfm.pc.in
152
160
  ${CMAKE_CURRENT_BINARY_DIR}/libcmark-gfm.pc @ONLY)
153
161
  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcmark-gfm.pc
154
- DESTINATION lib${LIB_SUFFIX}/pkgconfig)
162
+ DESTINATION ${libdir}/pkgconfig)
155
163
 
156
164
  install(FILES
157
165
  cmark.h
@@ -161,7 +169,7 @@ if(CMARK_SHARED OR CMARK_STATIC)
161
169
  DESTINATION include
162
170
  )
163
171
 
164
- install(EXPORT cmark-gfm DESTINATION lib${LIB_SUFFIX}/cmake-gfm)
172
+ install(EXPORT cmark-gfm DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
165
173
  endif()
166
174
 
167
175
  # Feature tests
@@ -21,6 +21,7 @@
21
21
  #include "inlines.h"
22
22
  #include "houdini.h"
23
23
  #include "buffer.h"
24
+ #include "footnotes.h"
24
25
 
25
26
  #define CODE_INDENT 4
26
27
  #define TAB_STOP 4
@@ -97,7 +98,7 @@ static void cmark_parser_dispose(cmark_parser *parser) {
97
98
  cmark_node_free(parser->root);
98
99
 
99
100
  if (parser->refmap)
100
- cmark_reference_map_free(parser->refmap);
101
+ cmark_map_free(parser->refmap);
101
102
  }
102
103
 
103
104
  static void cmark_parser_reset(cmark_parser *parser) {
@@ -389,7 +390,7 @@ static cmark_node *add_child(cmark_parser *parser, cmark_node *parent,
389
390
  return child;
390
391
  }
391
392
 
392
- void cmark_manage_extensions_special_characters(cmark_parser *parser, bool add) {
393
+ void cmark_manage_extensions_special_characters(cmark_parser *parser, int add) {
393
394
  cmark_llist *tmp_ext;
394
395
 
395
396
  for (tmp_ext = parser->inline_syntax_extensions; tmp_ext; tmp_ext=tmp_ext->next) {
@@ -408,7 +409,7 @@ void cmark_manage_extensions_special_characters(cmark_parser *parser, bool add)
408
409
  // Walk through node and all children, recursively, parsing
409
410
  // string content into inline content where appropriate.
410
411
  static void process_inlines(cmark_parser *parser,
411
- cmark_reference_map *refmap, int options) {
412
+ cmark_map *refmap, int options) {
412
413
  cmark_iter *iter = cmark_iter_new(parser->root);
413
414
  cmark_node *cur;
414
415
  cmark_event_type ev_type;
@@ -429,6 +430,84 @@ static void process_inlines(cmark_parser *parser,
429
430
  cmark_iter_free(iter);
430
431
  }
431
432
 
433
+ static int sort_footnote_by_ix(const void *_a, const void *_b) {
434
+ cmark_footnote *a = *(cmark_footnote **)_a;
435
+ cmark_footnote *b = *(cmark_footnote **)_b;
436
+ return (int)a->ix - (int)b->ix;
437
+ }
438
+
439
+ static void process_footnotes(cmark_parser *parser) {
440
+ // * Collect definitions in a map.
441
+ // * Iterate the references in the document in order, assigning indices to
442
+ // definitions in the order they're seen.
443
+ // * Write out the footnotes at the bottom of the document in index order.
444
+
445
+ cmark_map *map = cmark_footnote_map_new(parser->mem);
446
+
447
+ cmark_iter *iter = cmark_iter_new(parser->root);
448
+ cmark_node *cur;
449
+ cmark_event_type ev_type;
450
+
451
+ while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
452
+ cur = cmark_iter_get_node(iter);
453
+ if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_DEFINITION) {
454
+ cmark_node_unlink(cur);
455
+ cmark_footnote_create(map, cur);
456
+ }
457
+ }
458
+
459
+ cmark_iter_free(iter);
460
+ iter = cmark_iter_new(parser->root);
461
+ unsigned int ix = 0;
462
+
463
+ while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) {
464
+ cur = cmark_iter_get_node(iter);
465
+ if (ev_type == CMARK_EVENT_EXIT && cur->type == CMARK_NODE_FOOTNOTE_REFERENCE) {
466
+ cmark_footnote *footnote = (cmark_footnote *)cmark_map_lookup(map, &cur->as.literal);
467
+ if (footnote) {
468
+ if (!footnote->ix)
469
+ footnote->ix = ++ix;
470
+
471
+ char n[32];
472
+ snprintf(n, sizeof(n), "%d", footnote->ix);
473
+ cmark_chunk_free(parser->mem, &cur->as.literal);
474
+ cmark_strbuf buf = CMARK_BUF_INIT(parser->mem);
475
+ cmark_strbuf_puts(&buf, n);
476
+
477
+ cur->as.literal = cmark_chunk_buf_detach(&buf);
478
+ } else {
479
+ cmark_node *text = (cmark_node *)parser->mem->calloc(1, sizeof(*text));
480
+ cmark_strbuf_init(parser->mem, &text->content, 0);
481
+ text->type = (uint16_t) CMARK_NODE_TEXT;
482
+
483
+ cmark_strbuf buf = CMARK_BUF_INIT(parser->mem);
484
+ cmark_strbuf_puts(&buf, "[^");
485
+ cmark_strbuf_put(&buf, cur->as.literal.data, cur->as.literal.len);
486
+ cmark_strbuf_putc(&buf, ']');
487
+
488
+ text->as.literal = cmark_chunk_buf_detach(&buf);
489
+ cmark_node_insert_after(cur, text);
490
+ cmark_node_free(cur);
491
+ }
492
+ }
493
+ }
494
+
495
+ cmark_iter_free(iter);
496
+
497
+ if (map->sorted) {
498
+ qsort(map->sorted, map->size, sizeof(cmark_map_entry *), sort_footnote_by_ix);
499
+ for (unsigned int i = 0; i < map->size; ++i) {
500
+ cmark_footnote *footnote = (cmark_footnote *)map->sorted[i];
501
+ if (!footnote->ix)
502
+ continue;
503
+ cmark_node_append_child(parser->root, footnote->node);
504
+ footnote->node = NULL;
505
+ }
506
+ }
507
+
508
+ cmark_map_free(map);
509
+ }
510
+
432
511
  // Attempts to parse a list item marker (bullet or enumerated).
433
512
  // On success, returns length of the marker, and populates
434
513
  // data with the details. On failure, returns 0.
@@ -533,6 +612,8 @@ static cmark_node *finalize_document(cmark_parser *parser) {
533
612
 
534
613
  finalize(parser, parser->root);
535
614
  process_inlines(parser, parser->refmap, parser->options);
615
+ if (parser->options & CMARK_OPT_FOOTNOTES)
616
+ process_footnotes(parser);
536
617
 
537
618
  return parser->root;
538
619
  }
@@ -759,6 +840,18 @@ static bool parse_block_quote_prefix(cmark_parser *parser, cmark_chunk *input) {
759
840
  return res;
760
841
  }
761
842
 
843
+ static bool parse_footnote_definition_block_prefix(cmark_parser *parser, cmark_chunk *input,
844
+ cmark_node *container) {
845
+ if (parser->indent >= 4) {
846
+ S_advance_offset(parser, input, 4, true);
847
+ return true;
848
+ } else if (input->len > 0 && (input->data[0] == '\n' || (input->data[0] == '\r' && input->data[1] == '\n'))) {
849
+ return true;
850
+ }
851
+
852
+ return false;
853
+ }
854
+
762
855
  static bool parse_node_item_prefix(cmark_parser *parser, cmark_chunk *input,
763
856
  cmark_node *container) {
764
857
  bool res = false;
@@ -913,6 +1006,10 @@ static cmark_node *check_open_blocks(cmark_parser *parser, cmark_chunk *input,
913
1006
  if (parser->blank)
914
1007
  goto done;
915
1008
  break;
1009
+ case CMARK_NODE_FOOTNOTE_DEFINITION:
1010
+ if (!parse_footnote_definition_block_prefix(parser, input, container))
1011
+ goto done;
1012
+ break;
916
1013
  default:
917
1014
  break;
918
1015
  }
@@ -1024,6 +1121,21 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
1024
1121
  *container = add_child(parser, *container, CMARK_NODE_THEMATIC_BREAK,
1025
1122
  parser->first_nonspace + 1);
1026
1123
  S_advance_offset(parser, input, input->len - 1 - parser->offset, false);
1124
+ } else if (!indented &&
1125
+ parser->options & CMARK_OPT_FOOTNOTES &&
1126
+ (matched = scan_footnote_definition(input, parser->first_nonspace))) {
1127
+ cmark_chunk c = cmark_chunk_dup(input, parser->first_nonspace + 2, matched - 2);
1128
+ cmark_chunk_to_cstr(parser->mem, &c);
1129
+
1130
+ while (c.data[c.len - 1] != ']')
1131
+ --c.len;
1132
+ --c.len;
1133
+
1134
+ S_advance_offset(parser, input, parser->first_nonspace + matched - parser->offset, false);
1135
+ *container = add_child(parser, *container, CMARK_NODE_FOOTNOTE_DEFINITION, parser->first_nonspace + matched + 1);
1136
+ (*container)->as.literal = c;
1137
+
1138
+ (*container)->internal_offset = matched;
1027
1139
  } else if ((!indented || cont_type == CMARK_NODE_LIST) &&
1028
1140
  (matched = parse_list_marker(
1029
1141
  parser->mem, input, parser->first_nonspace,