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,84 +0,0 @@
1
- ---
2
- title: Documentation
3
- in_menu: true
4
- sort_info: 7
5
- ---
6
- # kramdown Documentation
7
-
8
- ## Overview
9
-
10
- kramdown is first and foremost a library for converting text written in a superset of Markdown to
11
- HTML. However, due to its modular architecture it is able to support additional input and output
12
- formats. The following input and output formats are currently supported:
13
-
14
- * Input: [kramdown](parser/kramdown.html) (a superset of Markdown),
15
- [Markdown](parser/markdown.html), [HTML](parser/html.html)
16
-
17
- * Output: [HTML](converter/html.html), [LaTeX](converter/latex.html),
18
- [kramdown](converter/kramdown.html), [RemoveHtmlTags](converter/remove_html_tags.html) (a special
19
- converter which removes HTML tags, normally used in conjunction with the LaTeX or kramdown
20
- converters)
21
-
22
- The [kramdown syntax page](syntax.html) describes in detail what is supported and how it differs
23
- from standard Markdown.
24
-
25
- For all available options have a look at the [options documentation](options.html) or have a look at
26
- a parser/converter page to see which options they support!
27
-
28
-
29
- ## Usage
30
-
31
- {:ruby: .language-ruby}
32
-
33
- The kramdown package provides two ways for using it:
34
-
35
- * **As a library**
36
-
37
- kramdown uses basically the same API as [RedCloth], [BlueCloth] and [Maruku]:
38
-
39
- require 'kramdown'
40
-
41
- puts Kramdown::Document.new(text).to_html
42
- {:ruby}
43
-
44
- The second parameter to the `new` call is an options hash for (de)activating certain features. For
45
- example, to disable automatic header ID generation, you can do the following:
46
-
47
- puts Kramdown::Document.new(text, :auto_ids => false).to_html
48
- {:ruby}
49
-
50
- The default parser used is `kramdown`, however, you can select a different one with the `:input`
51
- option:
52
-
53
- puts Kramdown::Document.new(text, :input => 'html').to_latex
54
- {:ruby}
55
-
56
- You can also reuse the created document object to produce multiple outputs:
57
-
58
- doc = Kramdown::Document.new(text, :input => 'html')
59
- puts doc.to_html
60
- puts doc.to_latex
61
- {:ruby}
62
-
63
- More information on how to use or extend kramdown can be found in the [API
64
- documentation](rdoc/index.html)!
65
-
66
- * **As an application**
67
-
68
- Together with the library files a binary called `kramdown` is shipped which can be used to convert
69
- text in any supported input format to any supported output format. It either reads from the files
70
- specified as the command line arguments or from the standard input. For example:
71
-
72
- kramdown path/to/kramdown/doc/syntax.page
73
-
74
- The input and output formats as well as all available kramdown options are supported through
75
- command line switches.
76
-
77
-
78
- ## Tests
79
-
80
- kramdown uses various test suites to verify the correct working of the parsers and converters. For
81
- more information, have a look at the [tests document](tests.html).
82
-
83
-
84
- {include_file: doc/links.markdown}
@@ -1,20 +0,0 @@
1
- --- name:sidebar pipeline:erb,tags,kramdown
2
- <h1>Documentation</h1>
3
-
4
- * Parsers
5
- * [kramdown](parser/kramdown.html)
6
- * [Markdown](parser/markdown.html)
7
- * [HTML](parser/html.html)
8
- * Converters
9
- * [HTML](converter/html.html)
10
- * [LaTeX](converter/latex.html)
11
- * [kramdown](converter/kramdown.html)
12
- * [RemoveHtmlTags](converter/remove_html_tags.html)
13
- * [Configuration Options](options.html)
14
- * [Tests](tests.html)
15
-
16
- <% if context.node.children.first && context.node.children.first.children.length > 1 %>
17
- <h1>Contents</h1>
18
- <% end %>
19
-
20
- {menu: {options: {descendants: true, levels: [3,6]}}}
@@ -1,94 +0,0 @@
1
- ---
2
- title: Home
3
- in_menu: true
4
- sort_info: 1
5
- ---
6
- ## Overview
7
-
8
- If you want to get started with kramdown, have a look at the [installation page](installation.html)
9
- to see how you can install it on your system. Then look through the
10
- [documentation](documentation.html) for finding information about how to actually use kramdown and
11
- its parsers/converters. The [quick reference](quickref.html) provides a overview of the syntax -- if
12
- you need a more detailed description of the superset of Markdown which kramdown supports the [syntax
13
- page](syntax.html) is the place to go!
14
-
15
- {tikz::
16
- path: overview.png
17
- img_attr: {style: 'background:transparent'}
18
- content_processor.tikz.libraries: [mindmap, trees, arrows]
19
- content_processor.tikz.transparent: true
20
- content_processor.tikz.resolution: 300 100
21
- content_processor.tikz.opts: |
22
- mindmap, concept color=black, text=white,
23
- root concept/.append style={font=\Large},
24
- level 1 concept/.append style={font=\Large, minimum size=2.6cm},
25
- level 2 concept/.append style={font=\Large},
26
- }
27
- \node[concept, font=\Large] (lib) {kramdown's internal representation}
28
- child[concept color=orange, grow=140, ->] {node[concept] (i-kramdown) {kramdown}}
29
- child[concept color=orange, grow=180] {node[concept] (i-html) {HTML}}
30
- child[concept color=orange, grow=220] {node[concept] (i-markdown) {Markdown}}
31
- child[concept color=green!50!black, grow=40] {node[concept] (o-html) {HTML}}
32
- child[concept color=green!50!black, grow=0] {node[concept] (o-kramdown) {kramdown}}
33
- child[concept color=green!50!black, grow=-40] {
34
- node[concept] (o-latex) {\LaTeX}
35
- child[grow=0] {
36
- node[concept] (o-latex-pdf) {PDF}
37
- }
38
- }
39
- child[concept color=green!50!black, grow=-40] {node[concept] {\LaTeX}}
40
- ;
41
- \draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=15pt,shorten <=10pt,color=orange]
42
- (i-kramdown) edge(lib)
43
- (i-markdown) edge(lib)
44
- (i-html) edge (lib);
45
- \draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=10pt,shorten <=15pt,color=green!50!black]
46
- (lib) edge(o-html)
47
- (lib) edge (o-kramdown)
48
- (lib) edge (o-latex);
49
- {tikz}
50
- {: style="text-align: center"}
51
-
52
-
53
- ## Bugs, Forums, Mailing Lists
54
-
55
- If you have found a bug, you should [report it here][bug_report]. Also, there are [forums][forum]
56
- and [mailing lists][ml] available if you have any questions!
57
-
58
- [bug_report]: http://rubyforge.org/tracker/?atid=28673&group_id=7403&func=browse
59
- [forum]: http://rubyforge.org/forum/?group_id=7403
60
- [ml]: http://rubyforge.org/mail/?group_id=7403
61
-
62
-
63
- ## Thanks
64
-
65
- kramdown would not be possible without the prior work of many other people. I want to thank everyone
66
- involved with making Markdown such a nice markup language and especially the developers of other
67
- Markdown implementations because kramdown borrowed many ideas from existing packages.
68
-
69
-
70
- ## Author
71
-
72
- * Thomas Leitner
73
- * e-Mail: <t_leitner@gmx.at>
74
- * GPG Key-Id: 0xB2D0A854
75
-
76
-
77
- [PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
78
- [Maruku]: http://maruku.rubyforge.org
79
- [BlueCloth]: http://www.deveiate.org/projects/BlueCloth
80
-
81
-
82
- --- name:intro
83
-
84
- **kramdown** (sic, not Kramdown or KramDown, just kramdown) is a *free* GPL-licensed
85
- [Ruby](http://www.ruby-lang.org) library for parsing and converting a superset of Markdown. It is
86
- completely written in Ruby, supports standard Markdown (with some minor modifications) and various
87
- extensions that have been made popular by the [PHP Markdown Extra] package and [Maruku].
88
-
89
- It is probably the fastest pure-Ruby Markdown converter available (January 2013), being about 4x
90
- faster than [Maruku] and about 5x faster than [BlueFeather].
91
-
92
- [PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
93
- [Maruku]: http://maruku.rubyforge.org
94
- [BlueFeather]: http://ruby.morphball.net/bluefeather/index_en.html
@@ -1,88 +0,0 @@
1
- ---
2
- title: Installation
3
- in_menu: true
4
- sort_info: 5
5
- ---
6
- # Download & Installation
7
-
8
- ## Dependencies
9
-
10
- Since kramdown is written in Ruby, you just need the [Ruby interpreter](http://www.ruby-lang.org),
11
- version 1.8.5, 1.8.6, 1.8.7, 1.9.2 or 1.9.3. There are no other dependencies.
12
-
13
-
14
- ## Compatibility Notes
15
-
16
- kramdown should work on any platform which supports Ruby. It has been successfully tested on the
17
- following platforms:
18
-
19
- * Linux with Ruby 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3 and jruby 1.6.0.
20
-
21
- See the platform specific installation notes for more information!
22
-
23
-
24
- ## Platform Specific Installation Instructions
25
-
26
- ### Linux
27
-
28
- There are a variety of Linux distributions out there with different package management systems. So
29
- we will focus on instructions for Ubuntu 9.04 here (which should probably also work for any newer
30
- Ubuntu version or any recent Debian based distribution).
31
-
32
- After running the following commands, kramdown is installed and ready to use:
33
-
34
- sudo aptitude install ruby rubygems
35
- sudo gem1.8 install kramdown
36
-
37
- > You will also need to add `export PATH=$PATH:/var/lib/gems/1.8/bin` to your `~/.bashrc` because
38
- > this is the binary path the executable files get installed to.
39
-
40
-
41
- ### Mac OS X
42
-
43
- Mac OS X Snow Leopard comes with Ruby and Rubygems preinstalled. So installing kramdown is as easy
44
- as running:
45
-
46
- sudo gem install kramdown
47
-
48
-
49
- ### Windows
50
-
51
- You need to install Ruby first. This can easily be done by using the [RubyInstaller] - just download
52
- the installation binary and run it. After that open a command shell (select `Start -> Run...`, then
53
- enter `cmd` and click on `Ok`) and type in the following:
54
-
55
- gem install kramdown
56
-
57
- [RubyInstaller]: http://rubyinstaller.org
58
-
59
-
60
- ## Generic Installation Instructions
61
-
62
-
63
- ### Using Rubygems
64
-
65
- If you are using Rubygems, installing the latest version of kramdown is as simple as executing
66
-
67
- gem install kramdown
68
-
69
-
70
- ### Manual Installation
71
-
72
- The latest version of kramdown can always be downloaded as `.tar.gz` or `.zip` from [its files
73
- section on Rubyforge](http://rubyforge.org/frs/?group_id=7403). After the download the package needs
74
- to be decompressed and then you can install kramdown using the included `setup.rb` installation
75
- method:
76
-
77
- $ ruby setup.rb config
78
- $ ruby setup.rb setup
79
- $ ruby setup.rb install
80
-
81
-
82
- ### Using the repository version
83
-
84
- kramdown uses git as its versioning system and kramdown's repository is hosted on GitHub. The
85
- repository always contains a clean state of the current development version of kramdown. To check
86
- out kramdown use the following command:
87
-
88
- git clone git://github.com/gettalong/kramdown.git
@@ -1,6 +0,0 @@
1
- [Maruku]: http://maruku.rubyforge.org
2
- [PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
3
- [Pandoc]: http://johnmacfarlane.net/pandoc/
4
- [MathJax]: http://www.mathjax.org
5
- [BlueCloth]: http://deveiate.org/projects/BlueCloth
6
- [RedCloth]: http://redcloth.org/
@@ -1,3 +0,0 @@
1
- --- alcn
2
- [converter/*.html, parser/*.html, documentation.en.html, options.en.html, tests.en.html]:
3
- template: ../documentation.template
@@ -1,10 +0,0 @@
1
- ---
2
- title: kramdown News
3
- description: kramdown - a fast, pure Ruby Markdown-superset converter
4
- site_url: http://kramdown.rubyforge.org/
5
- author: Thomas Leitner
6
- author_url: http://kramdown.rubyforge.org
7
- entries: {alcn: news/*.html, sort: sort_info, reverse: true, limit: 10}
8
- versions:
9
- atom:
10
-
@@ -1,29 +0,0 @@
1
- ---
2
- title: News
3
- in_menu: false
4
- sort_info: 30
5
- --- pipeline:tags,blocks,fragments
6
-
7
- <h1>News</h1>
8
-
9
- <a href="{relocatable: news.atom}">Atom-Feed</a>
10
-
11
- <webgen:block name="newsdata" node="current" />
12
-
13
- --- name:newsdata pipeline:erb
14
- <%
15
- opts = {:alcn => '/news/*.html', :sort => 'sort_info', :reverse => true, :flatten => true}
16
- context.website.ext.item_tracker.add(context.dest_node, :nodes, :node_finder_option_set,
17
- {:opts => opts, :ref_alcn => context.node.alcn}, :content)
18
- context.website.ext.node_finder.find(opts, context.node).each do |node|
19
- # context.options['contentprocessor.kramdown.options'] = {:auto_id_prefix => node.lcn.tr('.', '-')}
20
- %>
21
-
22
- <div class='news-item'>
23
- <div class="news-date float-right">
24
- Published on <%= node['created_at'].strftime("%A, %d %B %Y") %>
25
- </div>
26
- <%= context.render_block(:name => 'content', :chain => [node]) %>
27
- </div>
28
-
29
- <% end %>
@@ -1,10 +0,0 @@
1
- ---
2
- title: Options
3
- ---
4
- ## Available Options
5
-
6
- The behaviour of kramdown can be adjusted via the available options. Below is a list of all
7
- currently available options. Have a look at the documentation of a converter or parser to see
8
- directly which options they support!
9
-
10
- {options: {items: all}}
@@ -1,598 +0,0 @@
1
- ---
2
- title: Quick Reference
3
- in_menu: true
4
- sort_info: 9
5
- --- name:sidebar
6
- <h1>Contents</h1>
7
-
8
- {menu: {options: {descendants: true, levels: [2,6]}}}
9
- --- name:content
10
- # Quick Reference
11
-
12
- Below are examples of all available structural elements that can be used in a kramdown text. Since
13
- the kramdown syntax is a superset of the Markdown syntax, only a small part of the available syntax
14
- is not available in standard Markdown syntax. Note, that only the most basic syntax information is
15
- given. However, a link to the detailed syntax for each element is provided (which also details the
16
- differences to the standard Markdown syntax). The quick reference is for version **<%=
17
- ::Kramdown::VERSION %>** of the syntax documentation.
18
-
19
- kramdown has two main classes of elements: block and span-level elements. Block-level elements are
20
- used to create paragraphs, headers, lists and so on whereas span-level elements are used to markup
21
- text phrases as emphasized, as a link and so on.
22
-
23
- All examples below feature the kramdown source, the converted HTML source (shown when hovering over
24
- the kramdown source) and the output as it appears in the browser. This looks like this:
25
-
26
- <table class="kdexample">
27
- <tr>
28
- <td><pre class="kdexample-before"><code>kramdown example code</code></pre></td>
29
- <td><pre class="kdexample-after-source"><code>Example code converted to HTML</code></pre>
30
- <div class="kdexample-after-live" style="clear:none">
31
- Live browser view of example code
32
- </div>
33
- </td>
34
- </tr>
35
- </table>
36
-
37
-
38
- # Block-level Elements - Main Structural Elements
39
-
40
- ## Paragraphs
41
-
42
- {kdlink: {oid: paragraphs, part: "paragraphs"}}
43
-
44
- Consecutive lines of text are considered to be one paragraph. As with other block level elements you
45
- have to add a blank line to separate it from the following block-level element:
46
-
47
- {kdexample::}
48
- The first paragraph.
49
-
50
- Another paragraph
51
- {kdexample}
52
-
53
- Explicit line breaks in a paragraph can be made by using two spaces or two backslashes at the end of a line:
54
-
55
- {kdexample::}
56
- This is a paragraph
57
- which contains a hard line break.
58
- {kdexample}
59
-
60
-
61
- ## Headers
62
-
63
- {kdlink: {oid: headers, part: "headers"}}
64
-
65
- kramdown supports Setext style headers and atx style headers. A header must always be preceded by a
66
- blank line except at the beginning of the document:
67
-
68
-
69
- {kdexample::}
70
- First level header
71
- ==================
72
-
73
- Second level header
74
- -------------------
75
- {kdexample}
76
-
77
- {kdexample::}
78
- # H1 header
79
-
80
- ## H2 header
81
-
82
- ### H3 header
83
-
84
- #### H4 header
85
-
86
- ##### H5 header
87
-
88
- ###### H6 header
89
- {kdexample}
90
-
91
- If you set the option `auto_ids` to `false` (for example, by using the `options` extension, see
92
- [Extensions](#extensions)), then the automatic header ID generation is turned off:
93
-
94
- {kdexample::}
95
- {::options auto_ids="false" /}
96
-
97
- # A header without an ID
98
- {kdexample}
99
-
100
-
101
- ## Blockquotes
102
-
103
- {kdlink: {oid: blockquotes, part: "blockquotes"}}
104
-
105
- A blockquote is started using the `>` marker followed by an optional space; all following lines that
106
- are also started with the blockquote marker belong to the blockquote. You can use any block-level
107
- elements inside a blockquote:
108
-
109
- {kdexample::}
110
- > A sample blockquote.
111
- >
112
- > >Nested blockquotes are
113
- > >also possible.
114
- >
115
- > ## Headers work too
116
- > This is the outer quote again.
117
- {kdexample}
118
-
119
- You may also be lazy with the `>` markers as long as there is no blank line:
120
-
121
- {kdexample::}
122
- > This is a blockquote
123
- continued on this
124
- and this line.
125
-
126
- But this is a separate paragraph.
127
- {kdexample}
128
-
129
- ## Code Blocks
130
-
131
- {kdlink: {oid: code-blocks, part: "code blocks"}}
132
-
133
- kramdown supports two different code block styles. One uses lines indented with either four spaces
134
- or one tab whereas the other uses lines with tilde characters as delimiters -- therefore the content
135
- does not need to be indented:
136
-
137
- {kdexample::}
138
- This is a sample code block.
139
-
140
- Continued here.
141
- {kdexample}
142
-
143
- {kdexample::}
144
- ~~~~~~
145
- This is also a code block.
146
- ~~~
147
- Ending lines must have at least as
148
- many tildes as the starting line.
149
- ~~~~~~~~~~~~
150
- {kdexample}
151
-
152
- The following is a code block with a language specified:
153
-
154
- {kdexample::}
155
- ~~~ ruby
156
- def what?
157
- 42
158
- end
159
- ~~~
160
- {kdexample}
161
-
162
-
163
- ## Horizontal Rules
164
-
165
- {kdlink: {oid: horizontal-rules, part: "horizontal rules"}}
166
-
167
- It is easy to insert a horizontal rule in kramdown: just use three or more asterisks, dashes or
168
- underscores, optionally separated by spaces or tabs, on an otherwise blank line:
169
-
170
- {kdexample::}
171
- * * *
172
-
173
- \---
174
-
175
- _ _ _ _
176
-
177
- ---------------
178
- {kdexample}
179
-
180
-
181
- ## Lists
182
-
183
- {kdlink: {oid: lists, part: "lists"}}
184
-
185
- kramdown supports ordered and unordered lists. Ordered lists are started by using a number followed
186
- by a period, a space and then the list item text. The content of a list item consists of block-level
187
- elements. All lines which have the same indent as the text of the line with the list marker belong
188
- to the list item:
189
-
190
- {kdexample::}
191
- 1. This is a list item
192
- 2. And another item
193
- 2. And the third one
194
- with additional text
195
- {kdexample}
196
-
197
- As with block quotes, you may be lazy when using the list item marker:
198
-
199
- {kdexample::}
200
- * A list item
201
- with additional text
202
- {kdexample}
203
-
204
- As the content consists of block-level elements you can do things like the following:
205
-
206
- {kdexample::}
207
- 1. This is a list item
208
-
209
- > with a blockquote
210
-
211
- # And a header
212
-
213
- 2. Followed by another item
214
- {kdexample}
215
-
216
- Nested lists are also easy to create:
217
-
218
- {kdexample::}
219
- 1. Item one
220
- 1. sub item one
221
- 2. sub item two
222
- 3. sub item three
223
- 2. Item two
224
- {kdexample}
225
-
226
- Lists can occur directly after other block-level elements, however, there has to be at least one
227
- blank line if you want to follow a paragraph with a list:
228
-
229
- {kdexample::}
230
- This is a paragraph.
231
- 1. This is NOT a list.
232
-
233
- 1. This is a list!
234
- {kdexample}
235
-
236
- Unordered lists are started by using an asterisk, a dash or a plus sign (they can be mixed) and a
237
- space. Apart from that unordered lists follow the same rules as ordered lists:
238
-
239
- {kdexample::}
240
- * Item one
241
- + Item two
242
- - Item three
243
- {kdexample}
244
-
245
- ## Definition Lists
246
-
247
- {kdlink: {oid: definition-lists, part: "definition lists"}}
248
-
249
- A definition list works similar to a normal list and is used to associate definitions with terms.
250
- Definition lists are started when a normal paragraph is followed by a line starting with a colon and
251
- then the definition text. One term can have many definitions and multiple terms can have the same
252
- definition. Each line of the preceding paragraph is assumed to contain one term, for example:
253
-
254
- {kdexample::}
255
- term
256
- : definition
257
- : another definition
258
-
259
- another term
260
- and another term
261
- : and a definition for the term
262
- {kdexample}
263
-
264
- If you insert a blank line before a definition (note: there must only be one blank line between the
265
- terms and the first definition), the definition will be wrapped in a paragraph:
266
-
267
- {kdexample::}
268
- term
269
-
270
- : definition
271
- : definition
272
- {kdexample}
273
-
274
- Each term can be styled using span-level elements and each definition is parsed as block-level
275
- elements, i.e. you can use any block-level in a definition. Just use the same indent for the lines
276
- following the definition line:
277
-
278
- {kdexample::}
279
- This *is* a term
280
-
281
- : This will be a para
282
-
283
- > a blockquote
284
-
285
- # A header
286
- {kdexample}
287
-
288
-
289
- ## Tables
290
-
291
- {kdlink: {oid: tables, part: "tables"}}
292
-
293
- kramdown supports a syntax for creating simple tables. A line starting with a pipe character (`|`)
294
- starts a table row. However, if the pipe characters is immediately followed by a dash (`-`), a
295
- separator line is created. Separator lines are used to split the table header from the table body
296
- (and optionally align the table columns) and to split the table body into multiple parts. If the
297
- pipe character is followed by an equal sign (`=`), the tables rows below it are part of the table
298
- footer.
299
-
300
- {kdexample::}
301
- | A simple | table |
302
- | with multiple | lines|
303
- {kdexample}
304
-
305
- {kdexample::}
306
- | Header1 | Header2 | Header3 |
307
- |:--------|:-------:|--------:|
308
- | cell1 | cell2 | cell3 |
309
- | cell4 | cell5 | cell6 |
310
- |----
311
- | cell1 | cell2 | cell3 |
312
- | cell4 | cell5 | cell6 |
313
- |=====
314
- | Foot1 | Foot2 | Foot3
315
- {: rules="groups"}
316
- {kdexample}
317
-
318
-
319
- ## HTML elements
320
-
321
- {kdlink: {oid: html-blocks, part: "HTML blocks"}}
322
-
323
- kramdown allows you to use block-level HTML tags (`div`, `p`, `pre`, ...) to markup whole blocks of
324
- text -- just start a line with a block-level HTML tag. kramdown syntax is normally not processed
325
- inside an HTML tag but this can be changed with the `parse_block_html` option. If this options is
326
- set to `true`, then the content of a block-level HTML tag is parsed by kramdown either as block
327
- level or span-level text, depending on the tag:
328
-
329
- {kdexample::}
330
- <div style="float: right">
331
- Something that stays right and is not wrapped in a para.
332
- </div>
333
-
334
- {::options parse_block_html="true" /}
335
-
336
- <div>
337
- This is wrapped in a para.
338
- </div>
339
- <p>
340
- This can contain only *span* level elements.
341
- </p>
342
- {kdexample}
343
-
344
-
345
- ## Block Attributes
346
-
347
- {kdlink: {oid: block-ials, part: "block IALs"}}
348
- {kdlink: {oid: attribute-list-definitions, part: "ALDs"}}
349
-
350
- You can assign any attribute to a block-level element. Just directly follow the block with a *block
351
- inline attribute list* (or short: block IAL). A block IAL consists of a left curly brace, followed
352
- by a colon, the attribute definitions and a right curly brace. Here is a simple example which sets the
353
- `title` attribute of a block quote:
354
-
355
- {kdexample::}
356
- > A nice blockquote
357
- {: title="Blockquote title"}
358
- {kdexample}
359
-
360
- As one often wants to set one or more CSS classes on an element, there is an easy shortcut:
361
-
362
- {kdexample::}
363
- > A nice blockquote
364
- {: .class1 .class2}
365
- {kdexample}
366
-
367
- A shortcut for setting the ID is also provided. Just prefix the ID with a hash symbol:
368
-
369
- {kdexample::}
370
- > A nice blockquote
371
- {: #with-an-id}
372
- {kdexample}
373
-
374
- Sometimes one wants to use the same attributes for many elements. kramdown allows you to define the
375
- attributes in one place with an *attribute list definition* (or short: ALD) and just reference this
376
- definition in a block IAL. An ALD has the same structure as a block IAL but the colon has to be
377
- replace with a colon, the reference name and another colon. By just using the reference name as-is
378
- in a block IAL, one can include the attributes of the referenced ALD:
379
-
380
- {kdexample::}
381
- {:refdef: .c1 #id .c2 title="title"}
382
- paragraph
383
- {: refdef}
384
- {kdexample}
385
-
386
- The order in a block IAL or ALD is important because later defined attributes overwrite (with the
387
- exception of the shortcut for CSS classes) prior defined attributes:
388
-
389
- {kdexample::}
390
- {:refdef: .c1 #id .c2 title="title"}
391
- paragraph
392
- {: refdef .c3 title="t" #para}
393
- {kdexample}
394
-
395
-
396
- ## Extensions
397
-
398
- {kdlink: {oid: extensions, part: "extensions"}}
399
-
400
- kramdown provides some less used functionality through a common syntax. This will allow the easy
401
- addition of other extensions if need arises. Currently, there are extensions for ignoring text (i.e.
402
- treating text as comment), for inserting arbitrary text as-is into the output and for setting
403
- kramdown options.
404
-
405
- Here is an example that shows how to insert comments into text:
406
-
407
- {kdexample::}
408
- This is a paragraph
409
- {::comment}
410
- This is a comment which is
411
- completely ignored.
412
- {:/comment}
413
- ... paragraph continues here.
414
-
415
- Extensions can also be used
416
- inline {::nomarkdown}**see**{:/}!
417
- {kdexample}
418
-
419
- As one can see from the above example, the syntax for extensions is nearly identical to that of
420
- ALDs. However, there is no trailing colon after the extension name and the extension end tag needs a
421
- slash between the colon and the extension name. One can also use the short form of the end tag, i.e.
422
- `{:/}`. Attribute definitions can be specified on the start tag by separating them with a space from
423
- the extension name. Also, if the extension does not have a body, there needs to be a slash right
424
- before the closing brace:
425
-
426
- {kdexample::}
427
- {::options auto_ids="false" /}
428
-
429
- # Header without id
430
- {kdexample}
431
-
432
-
433
-
434
-
435
- # Span-Level Elements - Text Modifiers
436
-
437
- ## Emphasis
438
-
439
- {kdlink: {oid: emphasis, part: "emphasis"}}
440
-
441
- Emphasis can be added to text by surrounding the text with either asterisks or underscores:
442
-
443
- {kdexample::}
444
- This is *emphasized*,
445
- _this_ too!
446
- {kdexample}
447
-
448
- Strong emphasis can be done by doubling the delimiters:
449
-
450
- {kdexample::}
451
- This is **strong**,
452
- __this__ too!
453
- {kdexample}
454
-
455
- The form with the asterisks can also be used to markup parts of words:
456
-
457
- {kdexample::}
458
- This w**ork**s as expected!
459
- {kdexample}
460
-
461
-
462
- ## Links and Images
463
-
464
- {kdlink: {oid: links-and-images, part: "links and images"}}
465
-
466
- A simple link can be created by surrounding the text with square brackets and the link URL with
467
- parentheses:
468
-
469
- {kdexample::}
470
- A [link](http://kramdown.rubyforge.org)
471
- to the kramdown homepage.
472
- {kdexample}
473
-
474
- You can also add title information to the link:
475
-
476
- {kdexample::}
477
- A [link](http://kramdown.rubyforge.org "hp")
478
- to the homepage.
479
- {kdexample}
480
-
481
- There is another way to create links which does not interrupt the text flow. The URL and title are
482
- defined using a reference name and this reference name is then used in square brackets instead of
483
- the link URL:
484
-
485
- {kdexample::}
486
- A [link][kramdown hp]
487
- to the homepage.
488
-
489
- [kramdown hp]: http://kramdown.rubyforge.org "hp"
490
- {kdexample}
491
-
492
- If the link text itself is the reference name, the second set of square brackets can be omitted:
493
-
494
- {kdexample::}
495
- A link to the [kramdown hp].
496
-
497
- [kramdown hp]: http://kramdown.rubyforge.org "hp"
498
- {kdexample}
499
-
500
- Images can be created in a similar way: just use an exclamation mark before the square brackets. The
501
- link text will become the alternative text of the image and the link URL specifies the image source:
502
-
503
- {kdexample::}
504
- An image: ![gras](img/image.jpg)
505
- {kdexample}
506
-
507
-
508
- ## Inline Code
509
-
510
- {kdlink: {oid: code-spans, part: "code spans"}}
511
-
512
- Text phrases can be easily marked up as code by surrounding them with backticks:
513
-
514
- {kdexample::}
515
- Use `Kramdown::Document.new(text).to_html`
516
- to convert the `text` in kramdown
517
- syntax to HTML.
518
- {kdexample}
519
-
520
- If you want to use literal backticks in your code, just use two or more backticks as delimiters. The
521
- space right after the beginning delimiter and the one right before the closing delimiter are ignore:
522
-
523
- {kdexample::}
524
- Use backticks to markup code,
525
- e.g. `` `code` ``.
526
- {kdexample}
527
-
528
-
529
- ## Footnotes
530
-
531
- {kdlink: {oid: footnotes, part: "footnotes"}}
532
-
533
- Footnotes can easily be used in kramdown. Just set a footnote marker (consists of square brackets
534
- with a caret and the footnote name inside) in the text and somewhere else the footnote definition (which
535
- basically looks like a reference link definition):
536
-
537
- {kdexample::}
538
- This is a text with a
539
- footnote[^1].
540
-
541
- [^1]: And here is the definition.
542
- {kdexample}
543
-
544
- The footnote definition can contain any block-level element, all lines following a footnote
545
- definition indented with four spaces or one tab belong to the definition:
546
-
547
- {kdexample::}
548
- This is a text with a
549
- footnote[^2].
550
-
551
- [^2]:
552
- And here is the definition.
553
-
554
- > With a quote!
555
- {kdexample}
556
-
557
- As can be seen above the footnote name is only used for the anchors and the numbering is done
558
- automatically in document order.
559
-
560
-
561
- ## Abbreviations
562
-
563
- {kdlink: {oid: abbreviations, part: "abbreviations"}}
564
-
565
- Abbreviations will work out of the box once you add an abbreviation definition. So you can just
566
- write the text and add the definitions later on.
567
-
568
- {kdexample::}
569
- This is an HTML
570
- example.
571
-
572
- *[HTML]: Hyper Text Markup Language
573
- {kdexample}
574
-
575
-
576
- ## HTML Elements
577
-
578
- {kdlink: {oid: html-spans, part: "HTML spans"}}
579
-
580
- HTML is not only supported on the block-level but also on the span-level:
581
-
582
- {kdexample::}
583
- This is <span style="color: red">written in
584
- red</span>.
585
- {kdexample}
586
-
587
-
588
- ## Inline Attributes
589
-
590
- {kdlink: {oid: span-ials, part: "span IALs"}}
591
-
592
- As with a block-level element you can assign any attribute to a span-level elements using a *span
593
- inline attribute list* (or short: span IAL). A span IAL has the same syntax as a block IAL and must
594
- immediately follow the span-level element:
595
-
596
- {kdexample::}
597
- This is *red*{: style="color: red"}.
598
- {kdexample}