kramdown 0.14.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kramdown might be problematic. Click here for more details.

Files changed (323) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTERS +63 -1
  3. data/COPYING +17 -11
  4. data/README.md +35 -14
  5. data/VERSION +1 -1
  6. data/bin/kramdown +92 -40
  7. data/data/kramdown/document.html +4 -0
  8. data/data/kramdown/document.latex +7 -0
  9. data/lib/kramdown.rb +3 -16
  10. data/lib/kramdown/converter.rb +42 -16
  11. data/lib/kramdown/converter/base.rb +102 -38
  12. data/lib/kramdown/converter/hash_ast.rb +38 -0
  13. data/lib/kramdown/converter/html.rb +232 -141
  14. data/lib/kramdown/converter/kramdown.rb +122 -104
  15. data/lib/kramdown/converter/latex.rb +95 -78
  16. data/lib/kramdown/converter/man.rb +300 -0
  17. data/lib/kramdown/converter/math_engine/mathjax.rb +32 -0
  18. data/lib/kramdown/converter/remove_html_tags.rb +8 -17
  19. data/lib/kramdown/converter/syntax_highlighter.rb +56 -0
  20. data/lib/kramdown/converter/syntax_highlighter/minted.rb +35 -0
  21. data/lib/kramdown/converter/syntax_highlighter/rouge.rb +85 -0
  22. data/lib/kramdown/converter/toc.rb +7 -20
  23. data/lib/kramdown/document.rb +30 -37
  24. data/lib/kramdown/element.rb +54 -27
  25. data/lib/kramdown/error.rb +3 -16
  26. data/lib/kramdown/options.rb +392 -247
  27. data/lib/kramdown/parser.rb +3 -16
  28. data/lib/kramdown/parser/base.rb +28 -33
  29. data/lib/kramdown/parser/html.rb +151 -119
  30. data/lib/kramdown/parser/kramdown.rb +87 -50
  31. data/lib/kramdown/parser/kramdown/abbreviation.rb +33 -27
  32. data/lib/kramdown/parser/kramdown/autolink.rb +7 -25
  33. data/lib/kramdown/parser/kramdown/blank_line.rb +6 -19
  34. data/lib/kramdown/parser/kramdown/block_boundary.rb +6 -18
  35. data/lib/kramdown/parser/kramdown/blockquote.rb +6 -19
  36. data/lib/kramdown/parser/kramdown/codeblock.rb +15 -24
  37. data/lib/kramdown/parser/kramdown/codespan.rb +20 -22
  38. data/lib/kramdown/parser/kramdown/emphasis.rb +15 -24
  39. data/lib/kramdown/parser/kramdown/eob.rb +3 -16
  40. data/lib/kramdown/parser/kramdown/escaped_chars.rb +3 -16
  41. data/lib/kramdown/parser/kramdown/extensions.rb +66 -56
  42. data/lib/kramdown/parser/kramdown/footnote.rb +21 -31
  43. data/lib/kramdown/parser/kramdown/header.rb +37 -37
  44. data/lib/kramdown/parser/kramdown/horizontal_rule.rb +5 -17
  45. data/lib/kramdown/parser/kramdown/html.rb +47 -56
  46. data/lib/kramdown/parser/kramdown/html_entity.rb +9 -19
  47. data/lib/kramdown/parser/kramdown/line_break.rb +4 -17
  48. data/lib/kramdown/parser/kramdown/link.rb +39 -38
  49. data/lib/kramdown/parser/kramdown/list.rb +124 -82
  50. data/lib/kramdown/parser/kramdown/math.rb +12 -24
  51. data/lib/kramdown/parser/kramdown/paragraph.rb +23 -24
  52. data/lib/kramdown/parser/kramdown/smart_quotes.rb +26 -66
  53. data/lib/kramdown/parser/kramdown/table.rb +41 -48
  54. data/lib/kramdown/parser/kramdown/typographic_symbol.rb +14 -22
  55. data/lib/kramdown/parser/markdown.rb +11 -23
  56. data/lib/kramdown/utils.rb +21 -18
  57. data/lib/kramdown/utils/configurable.rb +45 -0
  58. data/lib/kramdown/utils/entities.rb +287 -292
  59. data/lib/kramdown/utils/html.rb +27 -30
  60. data/lib/kramdown/utils/lru_cache.rb +41 -0
  61. data/lib/kramdown/utils/string_scanner.rb +81 -0
  62. data/lib/kramdown/utils/unidecoder.rb +50 -0
  63. data/lib/kramdown/version.rb +4 -17
  64. data/man/man1/kramdown.1 +340 -347
  65. data/test/run_tests.rb +7 -20
  66. data/test/test_files.rb +188 -100
  67. data/test/test_location.rb +216 -0
  68. data/test/test_string_scanner_kramdown.rb +27 -0
  69. data/test/testcases/block/03_paragraph/indented.html.gfm +18 -0
  70. data/test/testcases/block/03_paragraph/line_break_last_line.html +9 -0
  71. data/test/testcases/block/03_paragraph/line_break_last_line.text +9 -0
  72. data/test/testcases/block/03_paragraph/standalone_image.html +8 -0
  73. data/test/testcases/block/03_paragraph/standalone_image.text +6 -0
  74. data/test/testcases/block/03_paragraph/with_html_to_native.html +1 -0
  75. data/test/testcases/block/03_paragraph/with_html_to_native.options +1 -0
  76. data/test/testcases/block/03_paragraph/with_html_to_native.text +1 -0
  77. data/test/testcases/block/04_header/atx_header.html +15 -1
  78. data/test/testcases/block/04_header/atx_header.text +14 -1
  79. data/test/testcases/block/04_header/setext_header.html +3 -1
  80. data/test/testcases/block/04_header/setext_header.text +4 -1
  81. data/test/testcases/block/04_header/with_auto_id_stripping.html +1 -0
  82. data/test/testcases/block/04_header/with_auto_id_stripping.options +1 -0
  83. data/test/testcases/block/04_header/with_auto_id_stripping.text +1 -0
  84. data/test/testcases/block/04_header/with_auto_ids.html +2 -0
  85. data/test/testcases/block/04_header/with_auto_ids.options +1 -0
  86. data/test/testcases/block/04_header/with_auto_ids.text +2 -0
  87. data/test/testcases/block/06_codeblock/guess_lang_css_class.html +15 -0
  88. data/test/testcases/block/06_codeblock/guess_lang_css_class.options +2 -0
  89. data/test/testcases/block/06_codeblock/guess_lang_css_class.text +13 -0
  90. data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.latex +9 -0
  91. data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.options +4 -0
  92. data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.text +5 -0
  93. data/test/testcases/block/06_codeblock/highlighting-minted.latex +8 -0
  94. data/test/testcases/block/06_codeblock/highlighting-minted.options +3 -0
  95. data/test/testcases/block/06_codeblock/highlighting-minted.text +4 -0
  96. data/test/testcases/block/06_codeblock/highlighting-opts.html +6 -0
  97. data/test/testcases/block/06_codeblock/highlighting-opts.options +7 -0
  98. data/test/testcases/block/06_codeblock/highlighting-opts.text +4 -0
  99. data/test/testcases/block/06_codeblock/highlighting.html +5 -6
  100. data/test/testcases/block/06_codeblock/issue_gh45.html +164 -0
  101. data/test/testcases/block/06_codeblock/issue_gh45.test +188 -0
  102. data/test/testcases/block/06_codeblock/rouge/disabled.html +2 -0
  103. data/test/testcases/block/06_codeblock/rouge/disabled.options +4 -0
  104. data/test/testcases/block/06_codeblock/rouge/disabled.text +1 -0
  105. data/test/testcases/block/06_codeblock/rouge/multiple.html +11 -0
  106. data/test/testcases/block/06_codeblock/rouge/multiple.options +4 -0
  107. data/test/testcases/block/06_codeblock/rouge/multiple.text +11 -0
  108. data/test/testcases/block/06_codeblock/rouge/simple.html +10 -0
  109. data/test/testcases/block/06_codeblock/rouge/simple.options +3 -0
  110. data/test/testcases/block/06_codeblock/rouge/simple.text +9 -0
  111. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block.options +1 -1
  112. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.html +8 -0
  113. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.options +2 -0
  114. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.text +11 -0
  115. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.html +3 -0
  116. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.options +2 -0
  117. data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.text +4 -0
  118. data/test/testcases/block/07_horizontal_rule/error.html +2 -2
  119. data/test/testcases/block/07_horizontal_rule/normal.html +2 -0
  120. data/test/testcases/block/07_horizontal_rule/normal.text +3 -0
  121. data/test/testcases/block/08_list/brackets_in_item.latex +3 -0
  122. data/test/testcases/block/08_list/brackets_in_item.text +1 -0
  123. data/test/testcases/block/08_list/lazy_and_nested.html +9 -0
  124. data/test/testcases/block/08_list/lazy_and_nested.text +4 -0
  125. data/test/testcases/block/09_html/html5_attributes.html +2 -0
  126. data/test/testcases/block/09_html/html5_attributes.text +2 -0
  127. data/test/testcases/block/09_html/html_after_block.html +7 -0
  128. data/test/testcases/block/09_html/html_after_block.text +5 -0
  129. data/test/testcases/block/09_html/html_to_native/table_simple.html +13 -0
  130. data/test/testcases/block/09_html/html_to_native/table_simple.text +15 -0
  131. data/test/testcases/block/09_html/html_to_native/typography.html +1 -1
  132. data/test/testcases/block/09_html/not_parsed.html +1 -1
  133. data/test/testcases/block/09_html/processing_instruction.html +5 -6
  134. data/test/testcases/block/09_html/simple.html +1 -5
  135. data/test/testcases/block/09_html/simple.text +1 -5
  136. data/test/testcases/block/09_html/standalone_image_in_div.htmlinput +7 -0
  137. data/test/testcases/block/09_html/standalone_image_in_div.text +8 -0
  138. data/test/testcases/block/09_html/textarea.html +8 -0
  139. data/test/testcases/block/09_html/textarea.text +8 -0
  140. data/test/testcases/block/09_html/xml.html +8 -0
  141. data/test/testcases/block/09_html/xml.text +7 -0
  142. data/test/testcases/block/11_ial/simple.html +5 -1
  143. data/test/testcases/block/11_ial/simple.text +8 -1
  144. data/test/testcases/block/12_extension/options.html +4 -4
  145. data/test/testcases/block/12_extension/options.text +2 -0
  146. data/test/testcases/block/12_extension/options2.html +4 -4
  147. data/test/testcases/block/12_extension/options3.html +7 -6
  148. data/test/testcases/block/12_extension/options3.text +2 -2
  149. data/test/testcases/block/13_definition_list/auto_ids.html +15 -0
  150. data/test/testcases/block/13_definition_list/auto_ids.text +18 -0
  151. data/test/testcases/block/13_definition_list/item_ial.html +5 -0
  152. data/test/testcases/block/13_definition_list/item_ial.text +8 -0
  153. data/test/testcases/block/14_table/empty_tag_in_cell.html +8 -0
  154. data/test/testcases/block/14_table/empty_tag_in_cell.options +1 -0
  155. data/test/testcases/block/14_table/empty_tag_in_cell.text +1 -0
  156. data/test/testcases/block/14_table/errors.html +4 -0
  157. data/test/testcases/block/14_table/errors.text +4 -0
  158. data/test/testcases/block/14_table/header.html +21 -0
  159. data/test/testcases/block/14_table/header.text +7 -0
  160. data/test/testcases/block/14_table/simple.html +22 -7
  161. data/test/testcases/block/14_table/simple.text +4 -0
  162. data/test/testcases/block/14_table/table_with_footnote.html +4 -4
  163. data/test/testcases/block/15_math/gh_128.html +1 -0
  164. data/test/testcases/block/15_math/gh_128.text +1 -0
  165. data/test/testcases/block/15_math/no_engine.html +3 -0
  166. data/test/testcases/block/15_math/no_engine.options +1 -0
  167. data/test/testcases/block/15_math/no_engine.text +2 -0
  168. data/test/testcases/block/15_math/normal.html +17 -14
  169. data/test/testcases/block/15_math/normal.text +2 -0
  170. data/test/testcases/block/16_toc/toc_exclude.html +7 -7
  171. data/test/testcases/block/16_toc/toc_levels.html +5 -5
  172. data/test/testcases/block/16_toc/toc_levels.text +1 -1
  173. data/test/testcases/block/16_toc/toc_with_footnotes.html +5 -5
  174. data/test/testcases/block/16_toc/toc_with_links.html +8 -0
  175. data/test/testcases/block/16_toc/toc_with_links.options +2 -0
  176. data/test/testcases/block/16_toc/toc_with_links.text +8 -0
  177. data/test/testcases/cjk-line-break.html +4 -0
  178. data/test/testcases/cjk-line-break.options +1 -0
  179. data/test/testcases/cjk-line-break.text +12 -0
  180. data/test/testcases/man/example.man +123 -0
  181. data/test/testcases/man/example.text +85 -0
  182. data/test/testcases/man/heading-name-dash-description.man +4 -0
  183. data/test/testcases/man/heading-name-dash-description.text +1 -0
  184. data/test/testcases/man/heading-name-description.man +4 -0
  185. data/test/testcases/man/heading-name-description.text +2 -0
  186. data/test/testcases/man/heading-name-section-description.man +4 -0
  187. data/test/testcases/man/heading-name-section-description.text +1 -0
  188. data/test/testcases/man/heading-name-section.man +2 -0
  189. data/test/testcases/man/heading-name-section.text +1 -0
  190. data/test/testcases/man/heading-name.man +2 -0
  191. data/test/testcases/man/heading-name.text +1 -0
  192. data/test/testcases/man/sections.man +4 -0
  193. data/test/testcases/man/sections.text +11 -0
  194. data/test/testcases/man/text-escaping.man +8 -0
  195. data/test/testcases/man/text-escaping.text +7 -0
  196. data/test/testcases/span/01_link/empty.html +1 -1
  197. data/test/testcases/span/01_link/empty_title.htmlinput +3 -0
  198. data/test/testcases/span/01_link/empty_title.text +7 -0
  199. data/test/testcases/span/01_link/imagelinks.html +1 -0
  200. data/test/testcases/span/01_link/imagelinks.text +2 -0
  201. data/test/testcases/span/01_link/inline.html +1 -1
  202. data/test/testcases/span/01_link/latex_escaping.latex +6 -0
  203. data/test/testcases/span/01_link/latex_escaping.text +5 -0
  204. data/test/testcases/span/01_link/link_defs.html +1 -1
  205. data/test/testcases/span/01_link/link_defs.text +2 -1
  206. data/test/testcases/span/01_link/link_defs_with_ial.html +4 -0
  207. data/test/testcases/span/01_link/link_defs_with_ial.text +16 -0
  208. data/test/testcases/span/01_link/reference.html +3 -3
  209. data/test/testcases/span/02_emphasis/nesting.html +3 -0
  210. data/test/testcases/span/02_emphasis/nesting.text +4 -1
  211. data/test/testcases/span/02_emphasis/normal.html +19 -0
  212. data/test/testcases/span/02_emphasis/normal.options +1 -0
  213. data/test/testcases/span/02_emphasis/normal.text +17 -0
  214. data/test/testcases/span/03_codespan/highlighting-minted.latex +2 -0
  215. data/test/testcases/span/03_codespan/highlighting-minted.options +1 -0
  216. data/test/testcases/span/03_codespan/highlighting-minted.text +1 -0
  217. data/test/testcases/span/03_codespan/highlighting.html +1 -1
  218. data/test/testcases/span/03_codespan/normal-css-class.html +1 -0
  219. data/test/testcases/span/03_codespan/normal-css-class.options +2 -0
  220. data/test/testcases/span/03_codespan/normal-css-class.text +1 -0
  221. data/test/testcases/span/03_codespan/rouge/disabled.html +1 -0
  222. data/test/testcases/span/03_codespan/rouge/disabled.options +4 -0
  223. data/test/testcases/span/03_codespan/rouge/disabled.text +1 -0
  224. data/test/testcases/span/03_codespan/rouge/simple.html +1 -0
  225. data/test/testcases/span/03_codespan/rouge/simple.options +1 -0
  226. data/test/testcases/span/03_codespan/rouge/simple.text +1 -0
  227. data/test/testcases/span/04_footnote/backlink_inline.html +79 -0
  228. data/test/testcases/span/04_footnote/backlink_inline.options +1 -0
  229. data/test/testcases/span/04_footnote/backlink_inline.text +38 -0
  230. data/test/testcases/span/04_footnote/backlink_text.html +9 -0
  231. data/test/testcases/span/04_footnote/backlink_text.options +1 -0
  232. data/test/testcases/span/04_footnote/backlink_text.text +3 -0
  233. data/test/testcases/span/04_footnote/definitions.latex +2 -2
  234. data/test/testcases/span/04_footnote/footnote_nr.html +6 -6
  235. data/test/testcases/span/04_footnote/footnote_prefix.html +12 -0
  236. data/test/testcases/span/04_footnote/footnote_prefix.options +1 -0
  237. data/test/testcases/span/04_footnote/footnote_prefix.text +4 -0
  238. data/test/testcases/span/04_footnote/inside_footnote.html +17 -0
  239. data/test/testcases/span/04_footnote/inside_footnote.text +9 -0
  240. data/test/testcases/span/04_footnote/markers.html +16 -16
  241. data/test/testcases/span/04_footnote/markers.latex +3 -3
  242. data/test/testcases/span/04_footnote/markers.options +2 -0
  243. data/test/testcases/span/04_footnote/markers.text +2 -1
  244. data/test/testcases/span/04_footnote/placement.html +11 -0
  245. data/test/testcases/span/04_footnote/placement.options +1 -0
  246. data/test/testcases/span/04_footnote/placement.text +8 -0
  247. data/test/testcases/span/04_footnote/regexp_problem.html +14 -0
  248. data/test/testcases/span/04_footnote/regexp_problem.options +2 -0
  249. data/test/testcases/span/04_footnote/regexp_problem.text +52 -0
  250. data/test/testcases/span/04_footnote/without_backlink.html +9 -0
  251. data/test/testcases/span/04_footnote/without_backlink.options +1 -0
  252. data/test/testcases/span/04_footnote/without_backlink.text +3 -0
  253. data/test/testcases/span/05_html/button.html +7 -0
  254. data/test/testcases/span/05_html/button.text +7 -0
  255. data/test/testcases/span/05_html/mark_element.html +3 -0
  256. data/test/testcases/span/05_html/mark_element.text +3 -0
  257. data/test/testcases/span/05_html/normal.html +10 -1
  258. data/test/testcases/span/05_html/normal.text +9 -0
  259. data/test/testcases/span/05_html/raw_span_elements.html +2 -0
  260. data/test/testcases/span/05_html/raw_span_elements.text +2 -0
  261. data/test/testcases/span/05_html/xml.html +5 -0
  262. data/test/testcases/span/05_html/xml.text +5 -0
  263. data/test/testcases/span/abbreviations/abbrev.html +14 -1
  264. data/test/testcases/span/abbreviations/abbrev.text +18 -2
  265. data/test/testcases/span/abbreviations/in_footnote.html +9 -0
  266. data/test/testcases/span/abbreviations/in_footnote.text +5 -0
  267. data/test/testcases/span/autolinks/url_links.html +5 -4
  268. data/test/testcases/span/autolinks/url_links.text +1 -0
  269. data/test/testcases/span/line_breaks/normal.html +2 -2
  270. data/test/testcases/span/line_breaks/normal.latex +2 -2
  271. data/test/testcases/span/math/no_engine.html +1 -0
  272. data/test/testcases/span/math/no_engine.options +1 -0
  273. data/test/testcases/span/math/no_engine.text +1 -0
  274. data/test/testcases/span/math/normal.html +4 -3
  275. data/test/testcases/span/math/normal.text +2 -1
  276. data/test/testcases/span/text_substitutions/entities_as_char.html +1 -1
  277. data/test/testcases/span/text_substitutions/entities_as_char.options +1 -0
  278. data/test/testcases/span/text_substitutions/entities_as_char.text +1 -1
  279. data/test/testcases/span/text_substitutions/typography.html +22 -0
  280. data/test/testcases/span/text_substitutions/typography.text +22 -0
  281. data/test/testcases/span/text_substitutions/typography_subst.html +3 -0
  282. data/test/testcases/span/text_substitutions/typography_subst.latex +4 -0
  283. data/test/testcases/span/text_substitutions/typography_subst.options +8 -0
  284. data/test/testcases/span/text_substitutions/typography_subst.text +3 -0
  285. metadata +218 -67
  286. data/ChangeLog +0 -7436
  287. data/GPL +0 -674
  288. data/Rakefile +0 -306
  289. data/benchmark/benchmark.rb +0 -36
  290. data/benchmark/benchmark.sh +0 -74
  291. data/benchmark/generate_data.rb +0 -119
  292. data/benchmark/mdbasics.text +0 -306
  293. data/benchmark/mdsyntax.text +0 -888
  294. data/benchmark/testing.sh +0 -9
  295. data/benchmark/timing.sh +0 -10
  296. data/doc/bg.png +0 -0
  297. data/doc/default.scss.css +0 -181
  298. data/doc/default.template +0 -68
  299. data/doc/design.scss.css +0 -441
  300. data/doc/documentation.page +0 -84
  301. data/doc/documentation.template +0 -20
  302. data/doc/index.page +0 -94
  303. data/doc/installation.page +0 -88
  304. data/doc/links.markdown +0 -6
  305. data/doc/metainfo +0 -3
  306. data/doc/news.feed +0 -10
  307. data/doc/news.page +0 -29
  308. data/doc/options.page +0 -10
  309. data/doc/quickref.page +0 -598
  310. data/doc/sidebar.template +0 -21
  311. data/doc/syntax.page +0 -1700
  312. data/doc/tests.page +0 -91
  313. data/doc/virtual +0 -2
  314. data/lib/kramdown/compatibility.rb +0 -49
  315. data/lib/kramdown/utils/ordered_hash.rb +0 -100
  316. data/setup.rb +0 -1585
  317. data/test/testcases/block/07_horizontal_rule/error.html.19 +0 -7
  318. data/test/testcases/block/09_html/html_to_native/typography.html.19 +0 -1
  319. data/test/testcases/block/09_html/simple.html.19 +0 -64
  320. data/test/testcases/block/14_table/simple.html.19 +0 -177
  321. data/test/testcases/span/01_link/inline.html.19 +0 -46
  322. data/test/testcases/span/01_link/reference.html.19 +0 -37
  323. data/test/testcases/span/text_substitutions/entities_as_char.html.19 +0 -1
@@ -1,25 +1,14 @@
1
- # -*- coding: utf-8 -*-
1
+ # -*- coding: utf-8; frozen_string_literal: true -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
- # This file is part of kramdown.
7
- #
8
- # kramdown is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU General Public License as published by
10
- # the Free Software Foundation, either version 3 of the License, or
11
- # (at your option) any later version.
12
- #
13
- # This program is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU General Public License
19
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
6
+ # This file is part of kramdown which is licensed under the MIT.
20
7
  #++
21
8
  #
22
9
 
10
+ require 'rexml/parsers/baseparser'
11
+
23
12
  module Kramdown
24
13
 
25
14
  module Utils
@@ -38,12 +27,13 @@ module Kramdown
38
27
  def entity_to_str(e, original = nil)
39
28
  entity_output = @options[:entity_output]
40
29
 
41
- if e.char.respond_to?(:encoding) && entity_output == :as_char &&
42
- (c = e.char.encode(@root.options[:encoding]) rescue nil) && !ESCAPE_MAP.has_key?(c)
30
+ if entity_output == :as_char &&
31
+ (c = e.char.encode(@root.options[:encoding]) rescue nil) &&
32
+ ((c = e.char) == '"' || !ESCAPE_MAP.key?(c))
43
33
  c
44
34
  elsif (entity_output == :as_input || entity_output == :as_char) && original
45
35
  original
46
- elsif (entity_output == :symbolic || ESCAPE_MAP.has_key?(e.char)) && !e.name.nil?
36
+ elsif (entity_output == :symbolic || ESCAPE_MAP.key?(e.char)) && !e.name.nil?
47
37
  "&#{e.name};"
48
38
  else # default to :numeric
49
39
  "&##{e.code_point};"
@@ -52,7 +42,11 @@ module Kramdown
52
42
 
53
43
  # Return the HTML representation of the attributes +attr+.
54
44
  def html_attributes(attr)
55
- attr.map {|k,v| v.nil? || (k == 'id' && v.strip.empty?) ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\"" }.join('')
45
+ return '' if attr.empty?
46
+
47
+ attr.map do |k, v|
48
+ v.nil? || (k == 'id' && v.strip.empty?) ? '' : " #{k}=\"#{escape_html(v.to_s, :attribute)}\""
49
+ end.join('')
56
50
  end
57
51
 
58
52
  # :stopdoc:
@@ -60,24 +54,27 @@ module Kramdown
60
54
  '<' => '&lt;',
61
55
  '>' => '&gt;',
62
56
  '&' => '&amp;',
63
- '"' => '&quot;'
57
+ '"' => '&quot;',
64
58
  }
65
59
  ESCAPE_ALL_RE = /<|>|&/
66
60
  ESCAPE_TEXT_RE = Regexp.union(REXML::Parsers::BaseParser::REFERENCE_RE, /<|>|&/)
67
61
  ESCAPE_ATTRIBUTE_RE = Regexp.union(REXML::Parsers::BaseParser::REFERENCE_RE, /<|>|&|"/)
68
- ESCAPE_RE_FROM_TYPE = {
69
- :all => ESCAPE_ALL_RE,
70
- :text => ESCAPE_TEXT_RE,
71
- :attribute => ESCAPE_ATTRIBUTE_RE
72
- }
62
+ ESCAPE_RE_FROM_TYPE = {all: ESCAPE_ALL_RE, text: ESCAPE_TEXT_RE, attribute: ESCAPE_ATTRIBUTE_RE}
73
63
  # :startdoc:
74
64
 
75
65
  # Escape the special HTML characters in the string +str+. The parameter +type+ specifies what
76
- # is escaped: :all - all special HTML characters as well as entities, :text - all special HTML
77
- # characters except the quotation mark but no entities and :attribute - all special HTML
78
- # characters including the quotation mark but no entities.
66
+ # is escaped: :all - all special HTML characters except the quotation mark as well as
67
+ # entities, :text - all special HTML characters except the quotation mark but no entities and
68
+ # :attribute - all special HTML characters including the quotation mark but no entities.
79
69
  def escape_html(str, type = :all)
80
- str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m}
70
+ str.gsub(ESCAPE_RE_FROM_TYPE[type]) {|m| ESCAPE_MAP[m] || m }
71
+ end
72
+
73
+ REDUNDANT_LINE_BREAK_REGEX = /([\p{Han}\p{Hiragana}\p{Katakana}]+)\n([\p{Han}\p{Hiragana}\p{Katakana}]+)/u
74
+ def fix_cjk_line_break(str)
75
+ while str.gsub!(REDUNDANT_LINE_BREAK_REGEX, '\1\2')
76
+ end
77
+ str
81
78
  end
82
79
 
83
80
  end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8; frozen_string_literal: true -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+
10
+ module Kramdown
11
+ module Utils
12
+
13
+ # A simple least recently used (LRU) cache.
14
+ #
15
+ # The cache relies on the fact that Ruby's Hash class maintains insertion order. So deleting
16
+ # and re-inserting a key-value pair on access moves the key to the last position. When an
17
+ # entry is added and the cache is full, the first entry is removed.
18
+ class LRUCache
19
+
20
+ # Creates a new LRUCache that can hold +size+ entries.
21
+ def initialize(size)
22
+ @size = size
23
+ @cache = {}
24
+ end
25
+
26
+ # Returns the stored value for +key+ or +nil+ if no value was stored under the key.
27
+ def [](key)
28
+ (val = @cache.delete(key)).nil? ? nil : @cache[key] = val
29
+ end
30
+
31
+ # Stores the +value+ under the +key+.
32
+ def []=(key, value)
33
+ @cache.delete(key)
34
+ @cache[key] = value
35
+ @cache.shift if @cache.length > @size
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,81 @@
1
+ # -*- coding: utf-8; frozen_string_literal: true -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+
10
+ require 'strscan'
11
+
12
+ module Kramdown
13
+ module Utils
14
+
15
+ # This patched StringScanner adds line number information for current scan position and a
16
+ # start_line_number override for nested StringScanners.
17
+ class StringScanner < ::StringScanner
18
+
19
+ # The start line number. Used for nested StringScanners that scan a sub-string of the source
20
+ # document. The kramdown parser uses this, e.g., for span level parsers.
21
+ attr_reader :start_line_number
22
+
23
+ # Takes the start line number as optional second argument.
24
+ #
25
+ # Note: The original second argument is no longer used so this should be safe.
26
+ def initialize(string, start_line_number = 1)
27
+ super(string)
28
+ @start_line_number = start_line_number || 1
29
+ @previous_pos = 0
30
+ @previous_line_number = @start_line_number
31
+ end
32
+
33
+ # Sets the byte position of the scan pointer.
34
+ #
35
+ # Note: This also resets some internal variables, so always use pos= when setting the position
36
+ # and don't use any other method for that!
37
+ def pos=(pos)
38
+ if self.pos > pos
39
+ @previous_line_number = @start_line_number
40
+ @previous_pos = 0
41
+ end
42
+ super
43
+ end
44
+
45
+ # Return information needed to revert the byte position of the string scanner in a performant
46
+ # way.
47
+ #
48
+ # The returned data can be fed to #revert_pos to revert the position to the saved one.
49
+ #
50
+ # Note: Just saving #pos won't be enough.
51
+ def save_pos
52
+ [pos, @previous_pos, @previous_line_number]
53
+ end
54
+
55
+ # Revert the position to one saved by #save_pos.
56
+ def revert_pos(data)
57
+ self.pos = data[0]
58
+ @previous_pos, @previous_line_number = data[1], data[2]
59
+ end
60
+
61
+ # Returns the line number for current charpos.
62
+ #
63
+ # NOTE: Requires that all line endings are normalized to '\n'
64
+ #
65
+ # NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.
66
+ # However we add the one indirectly by using a one-based start_line_number.
67
+ def current_line_number
68
+ # Not using string[@previous_pos..best_pos].count('\n') because it is slower
69
+ strscan = ::StringScanner.new(string)
70
+ strscan.pos = @previous_pos
71
+ old_pos = pos + 1
72
+ @previous_line_number += 1 while strscan.skip_until(/\n/) && strscan.pos <= old_pos
73
+
74
+ @previous_pos = (eos? ? pos : pos + 1)
75
+ @previous_line_number
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8; frozen_string_literal: true -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+ # This file is based on code originally from the Stringex library and needs the data files from
10
+ # Stringex to work correctly.
11
+
12
+ module Kramdown
13
+ module Utils
14
+
15
+ # Provides the ability to tranliterate Unicode strings into plain ASCII ones.
16
+ module Unidecoder
17
+
18
+ gem 'stringex'
19
+ path = $:.find do |dir|
20
+ File.directory?(File.join(File.expand_path(dir), "stringex", "unidecoder_data"))
21
+ end
22
+
23
+ if !path
24
+ def self.decode(string)
25
+ string
26
+ end
27
+ else
28
+
29
+ CODEPOINTS = Hash.new do |h, k|
30
+ h[k] = YAML.load_file(File.join(path, "stringex", "unidecoder_data", "#{k}.yml"))
31
+ end
32
+
33
+ # Transliterate string from Unicode into ASCII.
34
+ def self.decode(string)
35
+ string.gsub(/[^\x00-\x7f]/u) do |codepoint|
36
+ begin
37
+ unpacked = codepoint.unpack("U")[0]
38
+ CODEPOINTS[sprintf("x%02x", unpacked >> 8)][unpacked & 255]
39
+ rescue StandardError
40
+ "?"
41
+ end
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
50
+ end
@@ -1,28 +1,15 @@
1
- # -*- coding: utf-8 -*-
1
+ # -*- coding: utf-8; frozen_string_literal: true -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2012 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
- # This file is part of kramdown.
7
- #
8
- # kramdown is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU General Public License as published by
10
- # the Free Software Foundation, either version 3 of the License, or
11
- # (at your option) any later version.
12
- #
13
- # This program is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU General Public License
19
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
6
+ # This file is part of kramdown which is licensed under the MIT.
20
7
  #++
21
8
  #
22
9
 
23
10
  module Kramdown
24
11
 
25
12
  # The kramdown version.
26
- VERSION = '0.14.2'
13
+ VERSION = '2.3.0'
27
14
 
28
15
  end
@@ -1,353 +1,346 @@
1
- .TH "KRAMDOWN" 1 "May 2012"
1
+ .\" generated by kramdown
2
+ .TH "KRAMDOWN" "1" "January 2019"
2
3
  .SH NAME
3
- kramdown \- a fast, pure-Ruby Markdown-superset converter
4
- .SH SYNOPSIS
5
- .B kramdown
6
- [\fIoptions\fR]
7
- [\fIFILE\fR ...]
8
- .SH DESCRIPTION
9
- kramdown is primarily used for parsing a superset of Markdown and converting it to different output
10
- formats. It supports standard Markdown (with some minor modifications) and various extensions like
11
- tables and definition lists. Due to its modular architecture it also allows other input formats than
12
- Markdown, for example, HTML.
13
-
14
- If \fIFILE\fR is not specified, kramdown reads from the standard input. The result is written to the
15
- standard output.
16
-
17
- There are two sets of options that kramdown accepts: The first one includes the options that are
18
- used directly by the kramdown binary. The second set of options controls how kramdown parses and
19
- converts its input.
20
- .SH OPTIONS
21
- .TP
22
- .B \-i, \-\-input ARG
23
- Specify the input format. Available input formats: kramdown (this is the default) or html.
24
- .TP
25
- .B \-o, \-\-output ARG
26
- Specify one or more output formats separated by commas: html (default), kramdown, latex or
27
- remove_html_tags.
28
- .TP
29
- .B \-v, \-\-version
30
- Show the version of kramdown.
31
- .TP
32
- .B \-h, \-\-help
33
- Show the help.
34
-
35
- .SH KRAMDOWN OPTIONS
36
-
37
- .TP
38
- .B \-\-template ARG
39
-
40
- The name of an ERB template file that should be used to wrap the output
41
-
42
- This is used to wrap the output in an environment so that the output can
43
- be used as a stand-alone document. For example, an HTML template would
44
- provide the needed header and body tags so that the whole output is a
45
- valid HTML file. If no template is specified, the output will be just
46
- the converted text.
47
-
48
- When resolving the template file, the given template name is used first.
49
- If such a file is not found, the converter extension is appended. If the
50
- file still cannot be found, the templates name is interpreted as a
51
- template name that is provided by kramdown (without the converter
52
- extension).
53
-
54
- kramdown provides a default template named 'document' for each converter.
55
-
56
- Default: ''
57
- Used by: all converters
58
-
59
-
60
- .TP
61
- .B \-\-[no\-]auto-ids
62
-
4
+ kramdown \- a fast, pure\-Ruby Markdown\-superset converter
5
+ .SH "SYNOPSIS"
6
+ \fBkramdown\fP [\fIoptions\fP] [\fIFILE\fP\.\.\.]
7
+ .SH "DESCRIPTION"
8
+ kramdown is primarily used for parsing a superset of Markdown and converting it to different output formats\. It supports standard Markdown (with some minor modifications) and various extensions like tables and definition lists\. Due to its modular architecture it also allows other input formats than Markdown, for example, HTML or Github Flavored Markdown\.
9
+ .P
10
+ If \fIFILE\fP is not specified, kramdown reads from the standard input\. The result is written to the standard output\.
11
+ .P
12
+ There are two sets of options that kramdown accepts: The first one includes the options that are used directly by the kramdown binary\. The second set of options controls how kramdown parses and converts its input\.
13
+ .P
14
+ Default values for this second set can be set using YAML via the configuration file \fBkramdownrc\fP\&\. Note that configuration option names use underscores, not dashes (dashes are just used in the CLI options names), and boolean options do not have a \fBno\fP variant but a value of \fBtrue\fP or \fBfalse\fP\&\. This file has to be in XDG_CONFIG_HOME on Linux/Unix, ~/Library/Preferences on macOS and ~/AppData/Local on Windows\.
15
+ .SH "CLI\-ONLY OPTIONS"
16
+ .TP
17
+ \fB\-i\fP \fIFORMAT\fP, \fB\-\-input\fP \fIFORMAT\fP
18
+ Specify the input format\. Available input formats: \fIkramdown\fP (this is the default), \fImarkdown\fP, or \fIhtml\fP\&\. The input format \fIGFM\fP is available through the \fBkramdown\-parser\-gfm\fP gem\.
19
+ .TP
20
+ \fB\-o\fP \fIFORMAT\fP, \fB\-\-output\fP \fIFORMAT\fP
21
+ Specify one or more output formats separated by commas: \fIhtml\fP (default), \fIkramdown\fP, \fIlatex\fP, \fIman\fP or \fIremove_html_tags\fP\&\. The converter \fIpdf\fP is available through the \fBkramdown\-converter\-pdf\fP gem\.
22
+ .TP
23
+ \fB\-x\fP \fIEXT\fP, \fB\-\-extension\fP \fIEXT\fP
24
+ Load one or more extensions\. The name of the extension should not include the \fBkramdown\-\fP prefix, e\.g\. just \fBparser\-gfm\fP\&\. Multiple extensions can be loaded by separating them with commas\.
25
+ .RS
26
+ .P
27
+ Note: This option has to be used before any other options that rely on the extension already being loaded\.
28
+ .RE
29
+ .TP
30
+ \fB\-\-no\-config\-file\fP
31
+ Do not read any configuration file\. Default behavior is to check for a configuration file and read it if it exists\.
32
+ .TP
33
+ \fB\-\-config\-file\fP \fIFILE\fP
34
+ Override the default path and name of the configuration file\.
35
+ .TP
36
+ \fB\-v\fP, \fB\-\-version\fP
37
+ Show the version of kramdown\.
38
+ .TP
39
+ \fB\-h\fP, \fB\-\-help\fP
40
+ Show the help\.
41
+ .SH "KRAMDOWN OPTIONS"
42
+ .TP
43
+ \fB\-\-auto\-id\-prefix\fP \fIARG\fP
44
+ Prefix used for automatically generated header IDs
45
+ .RS
46
+ .P
47
+ This option can be used to set a prefix for the automatically generated header IDs so that there is no conflict when rendering multiple kramdown documents into one output file separately\. The prefix should only contain characters that are valid in an ID!
48
+ .P
49
+ Default: \[u2018]\[u2019] Used by: HTML/Latex converter
50
+ .RE
51
+ .TP
52
+ \fB\-\-[no\-]auto\-id\-stripping\fP
53
+ Strip all formatting from header text for automatic ID generation
54
+ .RS
55
+ .P
56
+ If this option is \fBtrue\fP, only the text elements of a header are used for generating the ID later (in contrast to just using the raw header text line)\.
57
+ .P
58
+ This option will be removed in version 2\.0 because this will be the default then\.
59
+ .P
60
+ Default: false Used by: kramdown parser
61
+ .RE
62
+ .TP
63
+ \fB\-\-[no\-]auto\-ids\fP
63
64
  Use automatic header ID generation
64
-
65
- If this option is `true`, ID values for all headers are automatically
66
- generated if no ID is explicitly specified.
67
-
68
- Default: true
69
- Used by: HTML/Latex converter
70
-
71
-
72
- .TP
73
- .B \-\-auto-id-prefix ARG
74
-
75
- Prefix used for automatically generated heaer IDs
76
-
77
- This option can be used to set a prefix for the automatically generated
78
- header IDs so that there is no conflict when rendering multiple kramdown
79
- documents into one output file separately. The prefix should only
80
- contain characters that are valid in an ID!
81
-
82
- Default: ''
83
- Used by: HTML/Latex converter
84
-
85
-
86
- .TP
87
- .B \-\-[no\-]parse-block-html
88
-
89
- Process kramdown syntax in block HTML tags
90
-
91
- If this option is `true`, the kramdown parser processes the content of
92
- block HTML tags as text containing block-level elements. Since this is
93
- not wanted normally, the default is `false`. It is normally better to
94
- selectively enable kramdown processing via the markdown attribute.
95
-
96
- Default: false
97
- Used by: kramdown parser
98
-
99
-
100
- .TP
101
- .B \-\-[no\-]parse-span-html
102
-
103
- Process kramdown syntax in span HTML tags
104
-
105
- If this option is `true`, the kramdown parser processes the content of
106
- span HTML tags as text containing span-level elements.
107
-
108
- Default: true
109
- Used by: kramdown parser
110
-
111
-
112
- .TP
113
- .B \-\-[no\-]html-to-native
114
-
115
- Convert HTML elements to native elements
116
-
117
- If this option is `true`, the parser converts HTML elements to native
118
- elements. For example, when parsing `<em>hallo</em>` the emphasis tag
119
- would normally be converted to an `:html` element with tag type `:em`.
120
- If `html_to_native` is `true`, then the emphasis would be converted to a
121
- native `:em` element.
122
-
123
- This is useful for converters that cannot deal with HTML elements.
124
-
125
- Default: false
126
- Used by: kramdown parser
127
-
128
-
129
- .TP
130
- .B \-\-link-defs ARG
131
-
132
- Pre-defines link definitions
133
-
134
- This option can be used to pre-define link definitions. The value needs
135
- to be a Hash where the keys are the link identifiers and the values are
136
- two element Arrays with the link URL and the link title.
137
-
138
- If the value is a String, it has to contain a valid YAML hash and the
139
- hash has to follow the above guidelines.
140
-
141
- Default: {}
142
- Used by: kramdown parser
143
-
144
-
145
- .TP
146
- .B \-\-footnote-nr ARG
147
-
148
- The number of the first footnote
149
-
150
- This option can be used to specify the number that is used for the first
151
- footnote.
152
-
153
- Default: 1
154
- Used by: HTML converter
155
-
156
-
157
- .TP
158
- .B \-\-[no\-]enable-coderay
159
-
160
- Use coderay for syntax highlighting
161
-
162
- If this option is `true`, coderay is used by the HTML converter for
163
- syntax highlighting the content of code spans and code blocks.
164
-
165
- Default: true
166
- Used by: HTML converter
167
-
168
-
169
- .TP
170
- .B \-\-coderay-wrap ARG
171
-
172
- Defines how the highlighted code should be wrapped
173
-
174
- The possible values are :span, :div or nil.
175
-
176
- Default: :div
177
- Used by: HTML converter
178
-
179
-
180
- .TP
181
- .B \-\-coderay-line-numbers ARG
182
-
183
- Defines how and if line numbers should be shown
184
-
185
- The possible values are :table, :inline or nil. If this option is
186
- nil, no line numbers are shown.
187
-
188
- Default: :inline
189
- Used by: HTML converter
190
-
191
-
192
- .TP
193
- .B \-\-coderay-line-number-start ARG
194
-
195
- The start value for the line numbers
196
-
197
- Default: 1
198
- Used by: HTML converter
199
-
200
-
201
- .TP
202
- .B \-\-coderay-tab-width ARG
203
-
204
- The tab width used in highlighted code
205
-
206
- Used by: HTML converter
207
-
208
-
209
- .TP
210
- .B \-\-coderay-bold-every ARG
211
-
212
- Defines how often a line number should be made bold
213
-
214
- Default: 10
215
- Used by: HTML converter
216
-
217
-
218
- .TP
219
- .B \-\-coderay-css ARG
220
-
221
- Defines how the highlighted code gets styled
222
-
223
- Possible values are :class (CSS classes are applied to the code
224
- elements, one must supply the needed CSS file) or :style (default CSS
225
- styles are directly applied to the code elements).
226
-
227
- Default: style
228
- Used by: HTML converter
229
-
230
-
231
- .TP
232
- .B \-\-coderay-default-lang ARG
233
-
234
- Sets the default language for highlighting code blocks
235
-
236
- If no language is set for a code block, the default language is used
237
- instead. The value has to be one of the languages supported by coderay
238
- or nil if no default language should be used.
239
-
240
- Default: nil
241
- Used by: HTML converter
242
-
243
-
244
- .TP
245
- .B \-\-entity-output ARG
246
-
65
+ .RS
66
+ .P
67
+ If this option is \fBtrue\fP, ID values for all headers are automatically generated if no ID is explicitly specified\.
68
+ .P
69
+ Default: true Used by: HTML/Latex converter
70
+ .RE
71
+ .TP
72
+ \fB\-\-entity\-output\fP \fIARG\fP
247
73
  Defines how entities are output
248
-
249
- The possible values are :as_input (entities are output in the same
250
- form as found in the input), :numeric (entities are output in numeric
251
- form), :symbolic (entities are output in symbolic form if possible) or
252
- :as_char (entities are output as characters if possible, only available
253
- on Ruby 1.9).
254
-
255
- Default: :as_char
256
- Used by: HTML converter, kramdown converter
257
-
258
-
259
- .TP
260
- .B \-\-toc-levels ARG
261
-
262
- Defines the levels that are used for the table of contents
263
-
264
- The individual levels can be specified by separating them with commas
265
- (e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
266
- specified levels are used for the table of contents.
267
-
268
- Default: 1..6
269
- Used by: HTML/Latex converter
270
-
271
-
272
- .TP
273
- .B \-\-line-width ARG
274
-
275
- Defines the line width to be used when outputting a document
276
-
277
- Default: 72
278
- Used by: kramdown converter
279
-
280
-
281
- .TP
282
- .B \-\-latex-headers ARG
283
-
74
+ .RS
75
+ .P
76
+ The possible values are :as_input (entities are output in the same form as found in the input), :numeric (entities are output in numeric form), :symbolic (entities are output in symbolic form if possible) or :as_char (entities are output as characters if possible, only available on Ruby 1\.9)\.
77
+ .P
78
+ Default: :as_char Used by: HTML converter, kramdown converter
79
+ .RE
80
+ .TP
81
+ \fB\-\-footnote\-backlink\fP \fIARG\fP
82
+ Defines the text that should be used for the footnote backlinks
83
+ .RS
84
+ .P
85
+ The footnote backlink is just text, so any special HTML characters will be escaped\.
86
+ .P
87
+ If the footnote backlint text is an empty string, no footnote backlinks will be generated\.
88
+ .P
89
+ Default: \[u2018]\[u0026]8617;\[u2019] Used by: HTML converter
90
+ .RE
91
+ .TP
92
+ \fB\-\-[no\-]footnote\-backlink\-inline\fP
93
+ Specifies whether the footnote backlink should always be inline
94
+ .RS
95
+ .P
96
+ With the default of false the footnote backlink is placed at the end of the last paragraph if there is one, or an extra paragraph with only the footnote backlink is created\.
97
+ .P
98
+ Setting this option to true tries to place the footnote backlink in the last, possibly nested paragraph or header\. If this fails (e\.g\. in the case of a table), an extra paragraph with only the footnote backlink is created\.
99
+ .P
100
+ Default: false Used by: HTML converter
101
+ .RE
102
+ .TP
103
+ \fB\-\-footnote\-nr\fP \fIARG\fP
104
+ The number of the first footnote
105
+ .RS
106
+ .P
107
+ This option can be used to specify the number that is used for the first footnote\.
108
+ .P
109
+ Default: 1 Used by: HTML converter
110
+ .RE
111
+ .TP
112
+ \fB\-\-footnote\-prefix\fP \fIARG\fP
113
+ Prefix used for footnote IDs
114
+ .RS
115
+ .P
116
+ This option can be used to set a prefix for footnote IDs\. This is useful when rendering multiple documents into the same output file to avoid duplicate IDs\. The prefix should only contain characters that are valid in an ID!
117
+ .P
118
+ Default: \[u2018]\[u2019] Used by: HTML
119
+ .RE
120
+ .TP
121
+ \fB\-\-forbidden\-inline\-options\fP \fIARG\fP
122
+ Defines the options that may not be set using the {::options} extension
123
+ .RS
124
+ .P
125
+ Default: template Used by: HTML converter
126
+ .RE
127
+ .TP
128
+ \fB\-\-header\-offset\fP \fIARG\fP
129
+ Sets the output offset for headers
130
+ .RS
131
+ .P
132
+ If this option is c (may also be negative) then a header with level n will be output as a header with level c+n\. If c+n is lower than 1, level 1 will be used\. If c+n is greater than 6, level 6 will be used\.
133
+ .P
134
+ Default: 0 Used by: HTML converter, Kramdown converter, Latex converter
135
+ .RE
136
+ .TP
137
+ \fB\-\-[no\-]html\-to\-native\fP
138
+ Convert HTML elements to native elements
139
+ .RS
140
+ .P
141
+ If this option is \fBtrue\fP, the parser converts HTML elements to native elements\. For example, when parsing \fB<em>hallo</em>\fP the emphasis tag would normally be converted to an \fB:html\fP element with tag type \fB:em\fP\&\. If \fBhtml_to_native\fP is \fBtrue\fP, then the emphasis would be converted to a native \fB:em\fP element\.
142
+ .P
143
+ This is useful for converters that cannot deal with HTML elements\.
144
+ .P
145
+ Default: false Used by: kramdown parser
146
+ .RE
147
+ .TP
148
+ \fB\-\-latex\-headers\fP \fIARG\fP
284
149
  Defines the LaTeX commands for different header levels
285
-
286
- The commands for the header levels one to six can be specified by
287
- separating them with commas.
288
-
289
- Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph
290
- Used by: Latex converter
291
-
292
-
293
- .TP
294
- .B \-\-smart-quotes ARG
295
-
296
- Defines the HTML entity names or code points for smart quote output
297
-
298
- The entities identified by entity name or code point that should be
299
- used for, in order, a left single quote, a right single quote, a left
300
- double and a right double quote are specified by separating them with
301
- commas.
302
-
303
- Default: lsquo,rsquo,ldquo,rdquo
304
- Used by: HTML/Latex converter
305
-
306
-
307
- .TP
308
- .B \-\-[no\-]remove-block-html-tags
309
-
150
+ .RS
151
+ .P
152
+ The commands for the header levels one to six can be specified by separating them with commas\.
153
+ .P
154
+ Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph Used by: Latex converter
155
+ .RE
156
+ .TP
157
+ \fB\-\-line\-width\fP \fIARG\fP
158
+ Defines the line width to be used when outputting a document
159
+ .RS
160
+ .P
161
+ Default: 72 Used by: kramdown converter
162
+ .RE
163
+ .TP
164
+ \fB\-\-link\-defs\fP \fIARG\fP
165
+ Pre\-defines link definitions
166
+ .RS
167
+ .P
168
+ This option can be used to pre\-define link definitions\. The value needs to be a Hash where the keys are the link identifiers and the values are two element Arrays with the link URL and the link title\.
169
+ .P
170
+ If the value is a String, it has to contain a valid YAML hash and the hash has to follow the above guidelines\.
171
+ .P
172
+ Default: {} Used by: kramdown parser
173
+ .RE
174
+ .TP
175
+ \fB\-\-math\-engine\fP \fIARG\fP
176
+ Set the math engine
177
+ .RS
178
+ .P
179
+ Specifies the math engine that should be used for converting math blocks/spans\. If this option is set to +nil+, no math engine is used and the math blocks/spans are output as is\.
180
+ .P
181
+ Options for the selected math engine can be set with the math_engine_opts configuration option\.
182
+ .P
183
+ Default: mathjax Used by: HTML converter
184
+ .RE
185
+ .TP
186
+ \fB\-\-math\-engine\-opts\fP \fIARG\fP
187
+ Set the math engine options
188
+ .RS
189
+ .P
190
+ Specifies options for the math engine set via the math_engine configuration option\.
191
+ .P
192
+ The value needs to be a hash with key\-value pairs that are understood by the used math engine\.
193
+ .P
194
+ Default: {} Used by: HTML converter
195
+ .RE
196
+ .TP
197
+ \fB\-\-[no\-]parse\-block\-html\fP
198
+ Process kramdown syntax in block HTML tags
199
+ .RS
200
+ .P
201
+ If this option is \fBtrue\fP, the kramdown parser processes the content of block HTML tags as text containing block\-level elements\. Since this is not wanted normally, the default is \fBfalse\fP\&\. It is normally better to selectively enable kramdown processing via the markdown attribute\.
202
+ .P
203
+ Default: false Used by: kramdown parser
204
+ .RE
205
+ .TP
206
+ \fB\-\-[no\-]parse\-span\-html\fP
207
+ Process kramdown syntax in span HTML tags
208
+ .RS
209
+ .P
210
+ If this option is \fBtrue\fP, the kramdown parser processes the content of span HTML tags as text containing span\-level elements\.
211
+ .P
212
+ Default: true Used by: kramdown parser
213
+ .RE
214
+ .TP
215
+ \fB\-\-[no\-]remove\-block\-html\-tags\fP
310
216
  Remove block HTML tags
311
-
312
- If this option is `true`, the RemoveHtmlTags converter removes
313
- block HTML tags.
314
-
315
- Default: true
316
- Used by: RemoveHtmlTags converter
317
-
318
-
319
- .TP
320
- .B \-\-[no\-]remove-span-html-tags
321
-
217
+ .RS
218
+ .P
219
+ If this option is \fBtrue\fP, the RemoveHtmlTags converter removes block HTML tags\.
220
+ .P
221
+ Default: true Used by: RemoveHtmlTags converter
222
+ .RE
223
+ .TP
224
+ \fB\-\-[no\-]remove\-line\-breaks\-for\-cjk\fP
225
+ Specifies whether line breaks should be removed between CJK characters
226
+ .RS
227
+ .P
228
+ Default: false Used by: HTML converter
229
+ .RE
230
+ .TP
231
+ \fB\-\-[no\-]remove\-span\-html\-tags\fP
322
232
  Remove span HTML tags
323
-
324
- If this option is `true`, the RemoveHtmlTags converter removes
325
- span HTML tags.
326
-
327
- Default: false
328
- Used by: RemoveHtmlTags converter
329
-
330
-
331
- .TP
332
- .B \-\-header-offset ARG
333
-
334
- Sets the output offset for headers
335
-
336
- If this option is c (may also be negative) then a header with level n
337
- will be output as a header with level c+n. If c+n is lower than 1,
338
- level 1 will be used. If c+n is greater than 6, level 6 will be used.
339
-
340
- Default: 0
341
- Used by: HTML converter, Kramdown converter, Latex converter
342
-
343
-
344
- .SH EXIT STATUS
345
- The exit status is 0 if no error happened. Otherwise it is 1.
346
- .SH SEE ALSO
347
- The kramdown website, http://kramdown.rubyforge.org/ for more information, especially on the supported
348
- input syntax.
349
- .SH AUTHOR
350
- kramdown was written by Thomas Leitner <t_leitner@gmx.at>.
351
- .PP
352
- This manual page was written by Thomas Leitner <t_leitner@gmx.at>.
353
-
233
+ .RS
234
+ .P
235
+ If this option is \fBtrue\fP, the RemoveHtmlTags converter removes span HTML tags\.
236
+ .P
237
+ Default: false Used by: RemoveHtmlTags converter
238
+ .RE
239
+ .TP
240
+ \fB\-\-smart\-quotes\fP \fIARG\fP
241
+ Defines the HTML entity names or code points for smart quote output
242
+ .RS
243
+ .P
244
+ The entities identified by entity name or code point that should be used for, in order, a left single quote, a right single quote, a left double and a right double quote are specified by separating them with commas\.
245
+ .P
246
+ Default: lsquo,rsquo,ldquo,rdquo Used by: HTML/Latex converter
247
+ .RE
248
+ .TP
249
+ \fB\-\-syntax\-highlighter\fP \fIARG\fP
250
+ Set the syntax highlighter
251
+ .RS
252
+ .P
253
+ Specifies the syntax highlighter that should be used for highlighting code blocks and spans\. If this option is set to +nil+, no syntax highlighting is done\.
254
+ .P
255
+ Options for the syntax highlighter can be set with the syntax_highlighter_opts configuration option\.
256
+ .P
257
+ Default: rouge Used by: HTML/Latex converter
258
+ .RE
259
+ .TP
260
+ \fB\-\-syntax\-highlighter\-opts\fP \fIARG\fP
261
+ Set the syntax highlighter options
262
+ .RS
263
+ .P
264
+ Specifies options for the syntax highlighter set via the syntax_highlighter configuration option\.
265
+ .P
266
+ The value needs to be a hash with key\-value pairs that are understood by the used syntax highlighter\.
267
+ .P
268
+ Default: {} Used by: HTML/Latex converter
269
+ .RE
270
+ .TP
271
+ \fB\-\-template\fP \fIARG\fP
272
+ The name of an ERB template file that should be used to wrap the output or the ERB template itself\.
273
+ .RS
274
+ .P
275
+ This is used to wrap the output in an environment so that the output can be used as a stand\-alone document\. For example, an HTML template would provide the needed header and body tags so that the whole output is a valid HTML file\. If no template is specified, the output will be just the converted text\.
276
+ .P
277
+ When resolving the template file, the given template name is used first\. If such a file is not found, the converter extension (the same as the converter name) is appended\. If the file still cannot be found, the templates name is interpreted as a template name that is provided by kramdown (without the converter extension)\. If the file is still not found, the template name is checked if it starts with \[u2018]string://\[u2019] and if it does, this prefix is removed and the rest is used as template content\.
278
+ .P
279
+ kramdown provides a default template named \[u2018]document\[u2019] for each converter\.
280
+ .P
281
+ Default: \[u2018]\[u2019] Used by: all converters
282
+ .RE
283
+ .TP
284
+ \fB\-\-toc\-levels\fP \fIARG\fP
285
+ Defines the levels that are used for the table of contents
286
+ .RS
287
+ .P
288
+ The individual levels can be specified by separating them with commas (e\.g\. 1,2,3) or by using the range syntax (e\.g\. 1\.\.3)\. Only the specified levels are used for the table of contents\.
289
+ .P
290
+ Default: 1\.\.6 Used by: HTML/Latex converter
291
+ .RE
292
+ .TP
293
+ \fB\-\-[no\-]transliterated\-header\-ids\fP
294
+ Transliterate the header text before generating the ID
295
+ .RS
296
+ .P
297
+ Only ASCII characters are used in headers IDs\. This is not good for languages with many non\-ASCII characters\. By enabling this option the header text is transliterated to ASCII as good as possible so that the resulting header ID is more useful\.
298
+ .P
299
+ The stringex library needs to be installed for this feature to work!
300
+ .P
301
+ Default: false Used by: HTML/Latex converter
302
+ .RE
303
+ .TP
304
+ \fB\-\-typographic\-symbols\fP \fIARG\fP
305
+ Defines a mapping from typographical symbol to output characters
306
+ .RS
307
+ .P
308
+ Typographical symbols are normally output using their equivalent Unicode codepoint\. However, sometimes one wants to change the output, mostly to fallback to a sequence of ASCII characters\.
309
+ .P
310
+ This option allows this by specifying a mapping from typographical symbol to its output string\. For example, the mapping {hellip: \.\.\.} would output the standard ASCII representation of an ellipsis\.
311
+ .P
312
+ The available typographical symbol names are:
313
+ .IP \(bu 4
314
+ hellip: ellipsis
315
+ .IP \(bu 4
316
+ mdash: em\-dash
317
+ .IP \(bu 4
318
+ ndash: en\-dash
319
+ .IP \(bu 4
320
+ laquo: left guillemet
321
+ .IP \(bu 4
322
+ raquo: right guillemet
323
+ .IP \(bu 4
324
+ laquo_space: left guillemet followed by a space
325
+ .IP \(bu 4
326
+ raquo_space: right guillemet preceeded by a space
327
+ .P
328
+ Default: {} Used by: HTML/Latex converter
329
+ .RE
330
+ .SH "EXIT STATUS"
331
+ The exit status is 0 if no error happened\. Otherwise it is 1\.
332
+ .SH "SEE ALSO"
333
+ The kramdown website
334
+ .UR http://kramdown\.gettalong\.org
335
+ .UE
336
+ for more information, especially on the supported input syntax\.
337
+ .SH "AUTHOR"
338
+ kramdown was written by Thomas Leitner
339
+ .MT t_leitner@gmx\.at
340
+ .UE
341
+ \&\.
342
+ .P
343
+ This manual page was written by Thomas Leitner
344
+ .MT t_leitner@gmx\.at
345
+ .UE
346
+ \&\.