kramdown 0.10.0 → 0.11.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 (132) hide show
  1. data/CONTRIBUTERS +1 -1
  2. data/ChangeLog +594 -0
  3. data/Rakefile +2 -2
  4. data/VERSION +1 -1
  5. data/data/kramdown/document.html +11 -2
  6. data/doc/default.template +2 -2
  7. data/doc/index.page +1 -2
  8. data/doc/quickref.page +2 -2
  9. data/doc/syntax.page +270 -179
  10. data/lib/kramdown/converter/html.rb +43 -29
  11. data/lib/kramdown/converter/kramdown.rb +97 -73
  12. data/lib/kramdown/converter/latex.rb +18 -13
  13. data/lib/kramdown/document.rb +8 -6
  14. data/lib/kramdown/options.rb +7 -10
  15. data/lib/kramdown/parser/html.rb +29 -21
  16. data/lib/kramdown/parser/kramdown.rb +19 -3
  17. data/lib/kramdown/parser/kramdown/abbreviation.rb +1 -0
  18. data/lib/kramdown/parser/kramdown/attribute_list.rb +18 -12
  19. data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
  20. data/lib/kramdown/parser/kramdown/block_boundary.rb +46 -0
  21. data/lib/kramdown/parser/kramdown/blockquote.rb +7 -3
  22. data/lib/kramdown/parser/kramdown/codeblock.rb +5 -3
  23. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  24. data/lib/kramdown/parser/kramdown/extension.rb +22 -8
  25. data/lib/kramdown/parser/kramdown/footnote.rb +3 -2
  26. data/lib/kramdown/parser/kramdown/header.rb +10 -10
  27. data/lib/kramdown/parser/kramdown/html.rb +16 -14
  28. data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
  29. data/lib/kramdown/parser/kramdown/link.rb +8 -8
  30. data/lib/kramdown/parser/kramdown/list.rb +36 -29
  31. data/lib/kramdown/parser/kramdown/math.rb +15 -4
  32. data/lib/kramdown/parser/kramdown/paragraph.rb +14 -3
  33. data/lib/kramdown/parser/kramdown/table.rb +17 -9
  34. data/lib/kramdown/utils.rb +1 -0
  35. data/lib/kramdown/utils/html.rb +9 -9
  36. data/lib/kramdown/utils/ordered_hash.rb +79 -0
  37. data/lib/kramdown/version.rb +1 -1
  38. data/man/man1/kramdown.1 +9 -12
  39. data/test/test_files.rb +6 -1
  40. data/test/testcases/block/02_eob/middle.html +0 -1
  41. data/test/testcases/block/04_header/atx_header.html +5 -2
  42. data/test/testcases/block/04_header/atx_header.text +3 -1
  43. data/test/testcases/block/04_header/setext_header.html +4 -5
  44. data/test/testcases/block/04_header/setext_header.html.19 +30 -0
  45. data/test/testcases/block/05_blockquote/lazy.html +34 -0
  46. data/test/testcases/block/05_blockquote/lazy.text +20 -0
  47. data/test/testcases/block/05_blockquote/nested.html +1 -0
  48. data/test/testcases/block/05_blockquote/nested.text +1 -0
  49. data/test/testcases/block/05_blockquote/with_code_blocks.html +2 -2
  50. data/test/testcases/block/06_codeblock/lazy.html +4 -0
  51. data/test/testcases/block/06_codeblock/lazy.text +5 -0
  52. data/test/testcases/block/06_codeblock/no_newline_at_end_1.html +2 -0
  53. data/test/testcases/block/06_codeblock/no_newline_at_end_1.text +2 -0
  54. data/test/testcases/block/06_codeblock/with_ial.html +6 -0
  55. data/test/testcases/block/06_codeblock/with_ial.text +5 -0
  56. data/test/testcases/block/07_horizontal_rule/normal.html +0 -2
  57. data/test/testcases/block/07_horizontal_rule/normal.text +0 -2
  58. data/test/testcases/block/08_list/item_ial.html +1 -3
  59. data/test/testcases/block/08_list/lazy.html +39 -0
  60. data/test/testcases/block/08_list/lazy.text +29 -0
  61. data/test/testcases/block/08_list/list_and_others.html +5 -3
  62. data/test/testcases/block/08_list/list_and_others.text +1 -0
  63. data/test/testcases/block/08_list/other_first_element.html +2 -2
  64. data/test/testcases/block/08_list/other_first_element.text +1 -1
  65. data/test/testcases/block/08_list/simple_ul.html +0 -13
  66. data/test/testcases/block/08_list/simple_ul.text +0 -7
  67. data/test/testcases/block/08_list/special_cases.html +8 -31
  68. data/test/testcases/block/08_list/special_cases.text +2 -15
  69. data/test/testcases/block/09_html/comment.html +2 -2
  70. data/test/testcases/block/09_html/html_to_native/emphasis.html +2 -0
  71. data/test/testcases/block/09_html/html_to_native/emphasis.text +2 -0
  72. data/test/testcases/block/09_html/html_to_native/table_normal.html +2 -1
  73. data/test/testcases/block/09_html/html_to_native/table_simple.html +4 -2
  74. data/test/testcases/block/09_html/invalid_html_1.html +2 -0
  75. data/test/testcases/block/09_html/parse_as_raw.html +2 -2
  76. data/test/testcases/block/09_html/parse_as_span.html +1 -1
  77. data/test/testcases/block/09_html/simple.html +2 -0
  78. data/test/testcases/block/09_html/simple.html.19 +2 -0
  79. data/test/testcases/block/09_html/simple.text +2 -0
  80. data/test/testcases/block/11_ial/auto_id_and_ial.html +1 -1
  81. data/test/testcases/block/11_ial/simple.html +2 -3
  82. data/test/testcases/block/12_extension/comment.html +3 -1
  83. data/test/testcases/block/12_extension/comment.text +2 -1
  84. data/test/testcases/block/12_extension/ignored.html +5 -1
  85. data/test/testcases/block/12_extension/ignored.text +1 -1
  86. data/test/testcases/block/12_extension/nomarkdown.html +5 -1
  87. data/test/testcases/block/12_extension/nomarkdown.kramdown +20 -0
  88. data/test/testcases/block/12_extension/nomarkdown.latex +13 -0
  89. data/test/testcases/block/12_extension/nomarkdown.text +11 -1
  90. data/test/testcases/block/13_definition_list/item_ial.html +1 -3
  91. data/test/testcases/block/13_definition_list/item_ial.text +1 -1
  92. data/test/testcases/block/13_definition_list/simple.html +2 -2
  93. data/test/testcases/block/14_table/errors.html +5 -0
  94. data/test/testcases/block/14_table/errors.text +6 -0
  95. data/test/testcases/block/14_table/header.text +1 -1
  96. data/test/testcases/block/14_table/no_table.text +1 -1
  97. data/test/testcases/block/14_table/simple.html +78 -0
  98. data/test/testcases/block/14_table/simple.text +22 -0
  99. data/test/testcases/block/15_math/normal.html +11 -4
  100. data/test/testcases/block/15_math/normal.text +10 -0
  101. data/test/testcases/encoding.html +1 -1
  102. data/test/testcases/span/01_link/image_in_a.html +3 -3
  103. data/test/testcases/span/01_link/imagelinks.html +7 -7
  104. data/test/testcases/span/01_link/inline.html +11 -5
  105. data/test/testcases/span/01_link/inline.html.19 +11 -5
  106. data/test/testcases/span/01_link/inline.text +11 -5
  107. data/test/testcases/span/01_link/link_defs.html +2 -1
  108. data/test/testcases/span/01_link/link_defs.text +4 -0
  109. data/test/testcases/span/01_link/reference.html +3 -0
  110. data/test/testcases/span/01_link/reference.html.19 +3 -0
  111. data/test/testcases/span/01_link/reference.text +5 -0
  112. data/test/testcases/span/03_codespan/highlighting.html +1 -0
  113. data/test/testcases/span/03_codespan/highlighting.text +1 -0
  114. data/test/testcases/span/04_footnote/definitions.html +3 -0
  115. data/test/testcases/span/04_footnote/definitions.latex +3 -4
  116. data/test/testcases/span/04_footnote/definitions.text +6 -0
  117. data/test/testcases/span/04_footnote/footnote_nr.latex +1 -5
  118. data/test/testcases/span/04_footnote/markers.latex +5 -14
  119. data/test/testcases/span/05_html/markdown_attr.html +1 -1
  120. data/test/testcases/span/05_html/markdown_attr.text +1 -1
  121. data/test/testcases/span/05_html/normal.html +5 -3
  122. data/test/testcases/span/05_html/normal.text +2 -0
  123. data/test/testcases/span/escaped_chars/normal.html +2 -0
  124. data/test/testcases/span/escaped_chars/normal.text +2 -0
  125. data/test/testcases/span/extension/comment.html +2 -2
  126. data/test/testcases/span/extension/ignored.html +1 -1
  127. data/test/testcases/span/text_substitutions/typography.html +1 -1
  128. data/test/testcases/span/text_substitutions/typography.html.19 +1 -1
  129. data/test/testcases/span/text_substitutions/typography.text +1 -1
  130. metadata +20 -5
  131. data/test/testcases/block/05_blockquote/only_first_quoted.html +0 -8
  132. data/test/testcases/block/05_blockquote/only_first_quoted.text +0 -4
@@ -60,3 +60,5 @@ weiter
60
60
  <p><em>Test
61
61
  </em>
62
62
  </p>
63
+
64
+ <iframe></iframe>
@@ -55,3 +55,5 @@ Another para.
55
55
  <p><em>Test
56
56
  </em>
57
57
  </p>
58
+
59
+ <iframe></iframe>
@@ -1 +1 @@
1
- <h2 class="cls" id="myid">A header</h2>
1
+ <h2 id="myid" class="cls">A header</h2>
@@ -1,6 +1,6 @@
1
- <p class="other-class myclass class" id="other" key1="val&quot;" key2="val'" key="val">Some paragraph.</p>
1
+ <p key1="val&quot;" key2="val'" class="other-class myclass class" id="other" key="val">Some paragraph.</p>
2
2
 
3
- <blockquote class="class" id="id">
3
+ <blockquote id="id" class="class">
4
4
  <p>quote</p>
5
5
  </blockquote>
6
6
 
@@ -23,4 +23,3 @@
23
23
 
24
24
  <h1 class="class" id="other">Another header</h1>
25
25
 
26
-
@@ -1,6 +1,8 @@
1
1
  <p>This is a simple paragraph.</p>
2
+
2
3
  <!-- This is a comment {:/}which is {:/comment} ignored. -->
4
+
3
5
  <p>And another paragraph</p>
4
6
 
5
- <p>Paragraph
7
+ <p>{::comment}
6
8
  Another paragraph</p>
@@ -1,11 +1,12 @@
1
1
  This is a simple paragraph.
2
+
2
3
  {::comment}
3
4
  This is a comment {:/}which is {:/comment} ignored.
4
5
  {:/comment}
6
+
5
7
  And another paragraph
6
8
 
7
9
  {::comment this='is' .ignore /}
8
10
 
9
- Paragraph
10
11
  {::comment}
11
12
  Another paragraph
@@ -1,4 +1,8 @@
1
1
  <p>paragraph</p>
2
2
 
3
- <p>paragraph
3
+ <p>{::something}
4
+ anotherthing
5
+ {:/something}</p>
6
+
7
+ <p>{::something/}
4
8
  paragraph</p>
@@ -1,8 +1,8 @@
1
1
  paragraph
2
+
2
3
  {::something}
3
4
  anotherthing
4
5
  {:/something}
5
6
 
6
- paragraph
7
7
  {::something/}
8
8
  paragraph
@@ -1,6 +1,10 @@
1
1
  <p>This is a simple paragraph.</p>
2
+
2
3
  This *is* not processed
4
+
3
5
  <p>And another paragraph</p>
4
6
 
5
- <p>Paragraph
7
+ <em>bold</em>
8
+
9
+ <p>{::nomarkdown}
6
10
  Another paragraph</p>
@@ -0,0 +1,20 @@
1
+ This is a simple paragraph.
2
+
3
+ {::nomarkdown}
4
+ This *is* not processed
5
+ {:/}
6
+
7
+ And another paragraph
8
+
9
+ {::nomarkdown type="html"}
10
+ <em>bold</em>
11
+ {:/}
12
+
13
+ {::nomarkdown type="latex"}
14
+ \begin{itemize}
15
+ \item[Yes] YESSSS!
16
+ \end{itemize}
17
+ {:/}
18
+
19
+ \{::nomarkdown} Another paragraph
20
+
@@ -0,0 +1,13 @@
1
+ This is a simple paragraph.
2
+
3
+ This *is* not processed
4
+
5
+ And another paragraph
6
+
7
+ \begin{itemize}
8
+ \item[Yes] YESSSS!
9
+ \end{itemize}
10
+
11
+ \{::nomarkdown\}
12
+ Another paragraph
13
+
@@ -1,11 +1,21 @@
1
1
  This is a simple paragraph.
2
+
2
3
  {::nomarkdown}
3
4
  This *is* not processed
4
5
  {:/nomarkdown}
6
+
5
7
  And another paragraph
6
8
 
7
9
  {::nomarkdown this='is' .ignore /}
8
10
 
9
- Paragraph
11
+ {::nomarkdown type='html'}
12
+ <em>bold</em>
13
+ {:/}
14
+ {::nomarkdown type="latex"}
15
+ \begin{itemize}
16
+ \item[Yes] YESSSS!
17
+ \end{itemize}
18
+ {:/}
19
+
10
20
  {::nomarkdown}
11
21
  Another paragraph
@@ -8,7 +8,5 @@ continued</dd>
8
8
  </code></pre>
9
9
  </dd>
10
10
  <dd class="cls">IAL at last
11
- <pre><code>code
12
- </code></pre>
13
- </dd>
11
+ no code bc of text</dd>
14
12
  </dl>
@@ -5,4 +5,4 @@ item
5
5
  : {:.class}
6
6
  code
7
7
  : {:.cls} IAL at last
8
- code
8
+ no code bc of text
@@ -2,7 +2,7 @@
2
2
  <dt>kram</dt>
3
3
  <dd>down</dd>
4
4
  <dt>kram</dt>
5
- <dd>down</dd>
6
- <dt>kram</dt>
5
+ <dd>down
6
+ kram</dd>
7
7
  <dd>down</dd>
8
8
  </dl>
@@ -1,3 +1,8 @@
1
1
  <p>No table body</p>
2
2
 
3
3
  <p>|-|-|-</p>
4
+
5
+ <p>|no|table|here|</p>
6
+
7
+ <p>|no|table|here|
8
+ paragraph</p>
@@ -1,3 +1,9 @@
1
1
  No table body
2
2
 
3
3
  |-|-|-
4
+
5
+ [5]: test
6
+ |no|table|here|
7
+
8
+ |no|table|here|
9
+ paragraph
@@ -26,7 +26,7 @@ With leading sep line
26
26
  Multiple bodies
27
27
 
28
28
  | cell1 | cell2
29
- + :-:
29
+ + :-: |
30
30
  | cell3 | cell4
31
31
  |----|||
32
32
  | cell5 | cell6
@@ -1,3 +1,3 @@
1
1
  No table
2
2
 
3
- \| Some | thing | here
3
+ \| Some \| thing \| here
@@ -59,3 +59,81 @@
59
59
  </tr>
60
60
  </tbody>
61
61
  </table>
62
+
63
+ <table class="cls">
64
+ <tbody>
65
+ <tr>
66
+ <td>table</td>
67
+ <td>with</td>
68
+ <td>ial</td>
69
+ </tr>
70
+ </tbody>
71
+ </table>
72
+
73
+ <table class="cls">
74
+ <tbody>
75
+ <tr>
76
+ <td>table</td>
77
+ <td>with</td>
78
+ <td>ial</td>
79
+ </tr>
80
+ </tbody>
81
+ </table>
82
+
83
+ <p>not starting with a bar</p>
84
+
85
+ <table>
86
+ <tbody>
87
+ <tr>
88
+ <td>simple</td>
89
+ <td>table</td>
90
+ </tr>
91
+ </tbody>
92
+ </table>
93
+
94
+ <table>
95
+ <thead>
96
+ <tr>
97
+ <th>head1</th>
98
+ <th>head2</th>
99
+ </tr>
100
+ </thead>
101
+ <tbody>
102
+ <tr>
103
+ <td>cell1</td>
104
+ <td>cell2</td>
105
+ </tr>
106
+ </tbody>
107
+ </table>
108
+
109
+ <table>
110
+ <thead>
111
+ <tr>
112
+ <th>head1</th>
113
+ <th>head2</th>
114
+ </tr>
115
+ </thead>
116
+ <tbody>
117
+ <tr>
118
+ <td>&nbsp;</td>
119
+ <td>cell2</td>
120
+ </tr>
121
+ </tbody>
122
+ </table>
123
+
124
+ <table>
125
+ <tbody>
126
+ <tr>
127
+ <td>a</td>
128
+ <td>b</td>
129
+ </tr>
130
+ <tr>
131
+ <td>c</td>
132
+ <td>d</td>
133
+ </tr>
134
+ <tr>
135
+ <td>e</td>
136
+ <td>f</td>
137
+ </tr>
138
+ </tbody>
139
+ </table>
@@ -14,3 +14,25 @@ Escaped pipe characters
14
14
  | cell1 \| cell1 | cell2 |
15
15
  | cell1 | cell2 \|
16
16
  | cell1 `\|` con | cell2
17
+
18
+ {:.cls}
19
+ | table | with | ial
20
+
21
+ | table | with | ial
22
+ {:.cls}
23
+
24
+ not starting with a bar
25
+
26
+ simple | table
27
+
28
+ head1 | head2
29
+ ------|------
30
+ cell1 | cell2
31
+
32
+ head1 | head2
33
+ -------|------
34
+ | cell2
35
+
36
+ | a | b |
37
+ c | d
38
+ | e | f |
@@ -1,10 +1,10 @@
1
- <p>This is a para.</p>
2
- <div class="math"> \text{LaTeX} \lambda_5 </div>
1
+ <p>This is a para.
2
+ <span class="math"> \text{LaTeX} \lambda_5 </span></p>
3
3
 
4
4
  <div class="math">\lambda_5 = \alpha + 4</div>
5
5
 
6
- <div class="math">\lambda_\alpha &gt; 5</div>
7
- <p>This is a para.</p>
6
+ <p><span class="math">\lambda_\alpha &gt; 5</span>
7
+ This is a para.</p>
8
8
 
9
9
  <div class="math">\begin{align*}
10
10
  &amp;=5 \\
@@ -12,8 +12,15 @@
12
12
  \end{align*}</div>
13
13
 
14
14
  <div class="math">5+5</div>
15
+
15
16
  <div class="math">5+5</div>
17
+
16
18
  <div class="math">5+5</div>
19
+
17
20
  <div class="math">5+5</div>
21
+
18
22
  <pre><code>$$5+5$$
19
23
  </code></pre>
24
+
25
+ <div class="cls math">5+5</div>
26
+ <div class="cls math">5+5</div>
@@ -12,7 +12,17 @@ $$\begin{align*}
12
12
  \end{align*}$$
13
13
 
14
14
  $$5+5$$
15
+
15
16
  $$5+5$$
17
+
16
18
  $$5+5$$
19
+
17
20
  $$5+5$$
21
+
18
22
  $$5+5$$
23
+
24
+ {:.cls}
25
+ $$5+5$$
26
+ ^
27
+ $$5+5$$
28
+ {:.cls}
@@ -1,6 +1,6 @@
1
1
  <p>Das ist gewöhnlich <em>ein</em> <a href="http://example.org">Über-Problem</a> mit manchen<br />
2
2
  Sälen <a href="http://example.org">http://example.org</a> und <span id="test">anderen Dinge</span>. Siehe
3
- <img alt="Über mich" src="http://example.org" />!</p>
3
+ <img src="http://example.org" alt="Über mich" />!</p>
4
4
 
5
5
  <blockquote class="test">
6
6
  <p>Vielleicht <em class="red">höre</em> ich nicht richtig?</p>
@@ -1,5 +1,5 @@
1
- <p>Simple: <a href="local.html">Some <img alt="alt text" src="/images/other.png" /></a></p>
1
+ <p>Simple: <a href="local.html">Some <img src="/images/other.png" alt="alt text" /></a></p>
2
2
 
3
- <p>Nested: <a href="local.html">Some <img alt="alt ![img](text.png) text" src="/images/other.png" /></a></p>
3
+ <p>Nested: <a href="local.html">Some <img src="/images/other.png" alt="alt ![img](text.png) text" /></a></p>
4
4
 
5
- <p>Simple: <a href="local.html">Some <em>text <img alt="alt text" src="/images/other.png" /> text</em></a></p>
5
+ <p>Simple: <a href="local.html">Some <em>text <img src="/images/other.png" alt="alt text" /> text</em></a></p>
@@ -1,14 +1,14 @@
1
- <p>Simple: <img alt="alt text" src="/images/other.png" /></p>
1
+ <p>Simple: <img src="/images/other.png" alt="alt text" /></p>
2
2
 
3
- <p>Simple with title: <img alt="alt text" src="/images/other.png" title="title" /></p>
3
+ <p>Simple with title: <img src="/images/other.png" alt="alt text" title="title" /></p>
4
4
 
5
- <p>Empty img link: <img alt="alt text" src="" /></p>
5
+ <p>Empty img link: <img src="" alt="alt text" /></p>
6
6
 
7
- <p>Reference style: <img alt="alt text" src="other.png" /></p>
7
+ <p>Reference style: <img src="other.png" alt="alt text" /></p>
8
8
 
9
- <p>Reference style with title: <img alt="alt text" src="other.png" title="Title" /></p>
9
+ <p>Reference style with title: <img src="other.png" alt="alt text" title="Title" /></p>
10
10
 
11
- <p>No alt text: <img alt="" src="other.png" /></p>
11
+ <p>No alt text: <img src="other.png" alt="" /></p>
12
12
 
13
- <p>No id: <img alt="imgo" src="other.png" title="Title" /></p>
13
+ <p>No id: <img src="other.png" alt="imgo" title="Title" /></p>
14
14
 
@@ -23,15 +23,21 @@
23
23
  <p>simple <a href="something.html" title="title">URL broken
24
24
  on line</a></p>
25
25
 
26
- <p>bad [URL <a href="something.html">not</a></p>
26
+ <p>simple <a href="with spaces.html">URL with spaces</a></p>
27
27
 
28
- <p>bad [URL with parens](something(new.html)</p>
28
+ <p>simple <a href="with spaces.html" title="title">URL with spaces</a></p>
29
+
30
+ <p>simple <a href="with (spaces).html">URL with spaces</a></p>
31
+
32
+ <p>simple <a href="spaces.html">leading/trailing spaces</a></p>
29
33
 
30
- <p>bad [URL with leading spaces]( something.html)</p>
34
+ <p>simple <a href="spaces.html">leading/trailing spaces</a></p>
31
35
 
32
- <p>bad [URL with trailing spaces](something.html )</p>
36
+ <p>simple <a href="spaces.html">leading/trailing spaces</a></p>
33
37
 
34
- <p>bad [URL with spaces](this is some url.html)</p>
38
+ <p>bad [URL <a href="something.html">not</a></p>
39
+
40
+ <p>bad [URL with parens](something(new.html)</p>
35
41
 
36
42
  <p>bad [URL with empty title](something.html &lsquo;&rsquo;)</p>
37
43