kramdown 1.4.2 → 1.5.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTERS +2 -1
  3. data/Rakefile +3 -0
  4. data/VERSION +1 -1
  5. data/doc/documentation.template +7 -0
  6. data/doc/sidebar.template +2 -2
  7. data/doc/virtual +9 -0
  8. data/lib/kramdown/converter.rb +39 -0
  9. data/lib/kramdown/converter/base.rb +28 -0
  10. data/lib/kramdown/converter/html.rb +25 -31
  11. data/lib/kramdown/converter/math_engine/itex2mml.rb +39 -0
  12. data/lib/kramdown/converter/math_engine/mathjax.rb +33 -0
  13. data/lib/kramdown/converter/math_engine/ritex.rb +38 -0
  14. data/lib/kramdown/converter/syntax_highlighter/coderay.rb +78 -0
  15. data/lib/kramdown/converter/syntax_highlighter/rouge.rb +37 -0
  16. data/lib/kramdown/element.rb +5 -5
  17. data/lib/kramdown/options.rb +96 -11
  18. data/lib/kramdown/parser/gfm.rb +5 -2
  19. data/lib/kramdown/parser/html.rb +3 -2
  20. data/lib/kramdown/utils.rb +18 -0
  21. data/lib/kramdown/utils/configurable.rb +44 -0
  22. data/lib/kramdown/version.rb +1 -1
  23. data/man/man1/kramdown.1 +62 -0
  24. data/test/test_files.rb +80 -56
  25. data/test/testcases/block/06_codeblock/highlighting-opts.html +6 -0
  26. data/test/testcases/block/06_codeblock/highlighting-opts.options +7 -0
  27. data/test/testcases/block/06_codeblock/highlighting-opts.text +4 -0
  28. data/test/testcases/block/06_codeblock/highlighting-rouge.html +6 -0
  29. data/test/testcases/block/06_codeblock/highlighting-rouge.options +3 -0
  30. data/test/testcases/block/06_codeblock/highlighting-rouge.text +4 -0
  31. data/test/testcases/block/06_codeblock/highlighting.html +2 -2
  32. data/test/testcases/block/12_extension/options3.html +2 -2
  33. data/test/testcases/block/15_math/itex2mml.html +1 -0
  34. data/test/testcases/block/15_math/itex2mml.options +1 -0
  35. data/test/testcases/block/15_math/itex2mml.text +1 -0
  36. data/test/testcases/block/15_math/ritex.html +1 -0
  37. data/test/testcases/block/15_math/ritex.options +1 -0
  38. data/test/testcases/block/15_math/ritex.text +1 -0
  39. data/test/testcases/span/03_codespan/highlighting-rouge.html +1 -0
  40. data/test/testcases/span/03_codespan/highlighting-rouge.options +1 -0
  41. data/test/testcases/span/03_codespan/highlighting-rouge.text +1 -0
  42. data/test/testcases/span/03_codespan/highlighting.html +1 -1
  43. data/test/testcases/span/05_html/button.html +7 -0
  44. data/test/testcases/span/05_html/button.text +7 -0
  45. data/test/testcases/span/math/itex2mml.html +1 -0
  46. data/test/testcases/span/math/itex2mml.options +1 -0
  47. data/test/testcases/span/math/itex2mml.text +1 -0
  48. data/test/testcases/span/math/ritex.html +1 -0
  49. data/test/testcases/span/math/ritex.options +1 -0
  50. data/test/testcases/span/math/ritex.text +1 -0
  51. data/test/testcases_gfm/backticks_syntax.html +2 -2
  52. data/test/testcases_gfm/hard_line_breaks.html +3 -0
  53. data/test/testcases_gfm/hard_line_breaks.text +3 -0
  54. metadata +75 -2
@@ -0,0 +1,6 @@
1
+ <div class="highlighter-coderay"><span class="CodeRay">x = <span class="constant">Class</span>.new
2
+ </span>
3
+ </div>
4
+ <div class="highlighter-coderay"><span class="CodeRay"><span class="tag">&lt;a&gt;</span>href<span class="tag">&lt;/a&gt;</span>
5
+ </span>
6
+ </div>
@@ -0,0 +1,7 @@
1
+ :syntax_highlighter_opts:
2
+ block:
3
+ css: class
4
+ default_lang: ruby
5
+ wrap: span
6
+ line_numbers: null
7
+
@@ -0,0 +1,4 @@
1
+ x = Class.new
2
+ ^
3
+ <a>href</a>
4
+ {: .language-html}
@@ -0,0 +1,6 @@
1
+ <div class="highlighter-rouge"><pre><code class="highlight"><span class="n">x</span> <span class="o">=</span> <span class="no">Class</span><span class="p">.</span><span class="nf">new</span>
2
+ </code></pre>
3
+ </div>
4
+ <div class="highlighter-rouge"><pre><code class="highlight"><span class="nt">&lt;a&gt;</span>href<span class="nt">&lt;/a&gt;</span>
5
+ </code></pre>
6
+ </div>
@@ -0,0 +1,3 @@
1
+ :syntax_highlighter: rouge
2
+ :syntax_highlighter_opts:
3
+ default_lang: ruby
@@ -0,0 +1,4 @@
1
+ x = Class.new
2
+ ^
3
+ <a>href</a>
4
+ {: .language-html}
@@ -1,6 +1,6 @@
1
- <div><span class="CodeRay">x = <span class="constant">Class</span>.new
1
+ <div class="highlighter-coderay"><span class="CodeRay">x = <span class="constant">Class</span>.new
2
2
  </span>
3
3
  </div>
4
- <div><span class="CodeRay"><span class="tag">&lt;a&gt;</span>href<span class="tag">&lt;/a&gt;</span>
4
+ <div class="highlighter-coderay"><span class="CodeRay"><span class="tag">&lt;a&gt;</span>href<span class="tag">&lt;/a&gt;</span>
5
5
  </span>
6
6
  </div>
@@ -1,7 +1,7 @@
1
- <div><span class="CodeRay">x = <span class="constant">Class</span>.new
1
+ <div class="highlighter-coderay"><span class="CodeRay">x = <span class="constant">Class</span>.new
2
2
  </span>
3
3
  </div>
4
4
 
5
- <div><span class="CodeRay">x = <span class="constant">Class</span>.new
5
+ <div class="highlighter-coderay"><span class="CodeRay">x = <span class="constant">Class</span>.new
6
6
  </span>
7
7
  </div>
@@ -0,0 +1 @@
1
+ <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><semantics><mrow><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mi>a</mi><mrow><msup><mi>x</mi> <mn>3</mn></msup></mrow><mo>+</mo><mi>b</mi><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow><mo>+</mo><mi>cx</mi><mo>+</mo><mi>d</mi></mrow><annotation encoding='application/x-tex'>f(x) = a{x^3} + b{x^2} + cx + d</annotation></semantics></math>
@@ -0,0 +1 @@
1
+ :math_engine: itex2mml
@@ -0,0 +1 @@
1
+ $$f(x) = a{x^3} + b{x^2} + cx + d$$
@@ -0,0 +1 @@
1
+ <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mi>f</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>=</mo><mi>a</mi><mrow><msup><mi>x</mi><mn>3</mn></msup></mrow><mo>+</mo><mi>b</mi><mrow><msup><mi>x</mi><mn>2</mn></msup></mrow><mo>+</mo><mi>c</mi><mi>x</mi><mo>+</mo><mi>d</mi></math>
@@ -0,0 +1 @@
1
+ :math_engine: ritex
@@ -0,0 +1 @@
1
+ $$f(x) = a{x^3} + b{x^2} + cx + d$$
@@ -0,0 +1 @@
1
+ <p>You can say <code class="language-ruby highlighter-rouge"><span class="n">x</span> <span class="o">=</span> <span class="no">Class</span><span class="p">.</span><span class="nf">new</span></code>, for example.</p>
@@ -0,0 +1 @@
1
+ :syntax_highlighter: rouge
@@ -0,0 +1 @@
1
+ You can say `x = Class.new`{:.language-ruby}, for example.
@@ -1 +1 @@
1
- <p>You can say <code class="language-ruby"><span class="CodeRay">x = <span style="color:#036;font-weight:bold">Class</span>.new</span></code>, for example.</p>
1
+ <p>You can say <code class="language-ruby highlighter-coderay"><span class="CodeRay">x = <span style="color:#036;font-weight:bold">Class</span>.new</span></code>, for example.</p>
@@ -0,0 +1,7 @@
1
+ <p><button>Some Text</button></p>
2
+
3
+ <p>First some text and then a <button>here</button></p>
4
+
5
+ <p><button>A button</button> and then text.</p>
6
+
7
+ <p>A <button>with <strong>some</strong> <code>code</code> in <img src="image.png" alt="alt" /></button> it.</p>
@@ -0,0 +1,7 @@
1
+ <button>Some Text</button>
2
+
3
+ First some text and then a <button>here</button>
4
+
5
+ <button>A button</button> and then text.
6
+
7
+ A <button>with **some** `code` in ![alt](image.png)</button> it.
@@ -0,0 +1 @@
1
+ <p>This is <math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><semantics><mrow><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mi>a</mi><mrow><msup><mi>x</mi> <mn>3</mn></msup></mrow><mo>+</mo><mi>b</mi><mrow><msup><mi>x</mi> <mn>2</mn></msup></mrow><mo>+</mo><mi>cx</mi><mo>+</mo><mi>d</mi></mrow><annotation encoding='application/x-tex'>f(x) = a{x^3} + b{x^2} + cx + d</annotation></semantics></math> something!</p>
@@ -0,0 +1 @@
1
+ :math_engine: itex2mml
@@ -0,0 +1 @@
1
+ This is $$f(x) = a{x^3} + b{x^2} + cx + d$$ something!
@@ -0,0 +1 @@
1
+ <p>This is <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mi>f</mi><mo stretchy='false'>(</mo><mi>x</mi><mo stretchy='false'>)</mo><mo>=</mo><mi>a</mi><mrow><msup><mi>x</mi><mn>3</mn></msup></mrow><mo>+</mo><mi>b</mi><mrow><msup><mi>x</mi><mn>2</mn></msup></mrow><mo>+</mo><mi>c</mi><mi>x</mi><mo>+</mo><mi>d</mi></math> something!</p>
@@ -0,0 +1 @@
1
+ :math_engine: ritex
@@ -0,0 +1 @@
1
+ This is $$f(x) = a{x^3} + b{x^2} + cx + d$$ something!
@@ -7,13 +7,13 @@
7
7
  <pre><code>Unbalanced bottom heavy
8
8
  </code></pre>
9
9
 
10
- <div><div class="CodeRay">
10
+ <div class="highlighter-coderay"><div class="CodeRay">
11
11
  <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>language no space
12
12
  </pre></div>
13
13
  </div>
14
14
  </div>
15
15
 
16
- <div><div class="CodeRay">
16
+ <div class="highlighter-coderay"><div class="CodeRay">
17
17
  <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>language with space
18
18
  </pre></div>
19
19
  </div>
@@ -0,0 +1,3 @@
1
+ <p>one<br />
2
+ <em>two</em><br />
3
+ three</p>
@@ -0,0 +1,3 @@
1
+ one
2
+ _two_
3
+ three
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rouge
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: stringex
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,34 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ritex
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: itextomml
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.5'
69
111
  description: |
70
112
  kramdown is yet-another-markdown-parser but fast, pure Ruby,
71
113
  using a strict syntax definition and supporting several common extensions.
@@ -116,8 +158,13 @@ files:
116
158
  - lib/kramdown/converter/html.rb
117
159
  - lib/kramdown/converter/kramdown.rb
118
160
  - lib/kramdown/converter/latex.rb
161
+ - lib/kramdown/converter/math_engine/itex2mml.rb
162
+ - lib/kramdown/converter/math_engine/mathjax.rb
163
+ - lib/kramdown/converter/math_engine/ritex.rb
119
164
  - lib/kramdown/converter/pdf.rb
120
165
  - lib/kramdown/converter/remove_html_tags.rb
166
+ - lib/kramdown/converter/syntax_highlighter/coderay.rb
167
+ - lib/kramdown/converter/syntax_highlighter/rouge.rb
121
168
  - lib/kramdown/converter/toc.rb
122
169
  - lib/kramdown/document.rb
123
170
  - lib/kramdown/element.rb
@@ -154,6 +201,7 @@ files:
154
201
  - lib/kramdown/parser/kramdown/typographic_symbol.rb
155
202
  - lib/kramdown/parser/markdown.rb
156
203
  - lib/kramdown/utils.rb
204
+ - lib/kramdown/utils/configurable.rb
157
205
  - lib/kramdown/utils/entities.rb
158
206
  - lib/kramdown/utils/html.rb
159
207
  - lib/kramdown/utils/ordered_hash.rb
@@ -224,6 +272,12 @@ files:
224
272
  - test/testcases/block/06_codeblock/disable-highlighting.text
225
273
  - test/testcases/block/06_codeblock/error.html
226
274
  - test/testcases/block/06_codeblock/error.text
275
+ - test/testcases/block/06_codeblock/highlighting-opts.html
276
+ - test/testcases/block/06_codeblock/highlighting-opts.options
277
+ - test/testcases/block/06_codeblock/highlighting-opts.text
278
+ - test/testcases/block/06_codeblock/highlighting-rouge.html
279
+ - test/testcases/block/06_codeblock/highlighting-rouge.options
280
+ - test/testcases/block/06_codeblock/highlighting-rouge.text
227
281
  - test/testcases/block/06_codeblock/highlighting.html
228
282
  - test/testcases/block/06_codeblock/highlighting.options
229
283
  - test/testcases/block/06_codeblock/highlighting.text
@@ -415,8 +469,14 @@ files:
415
469
  - test/testcases/block/14_table/table_with_footnote.text
416
470
  - test/testcases/block/15_math/gh_128.html
417
471
  - test/testcases/block/15_math/gh_128.text
472
+ - test/testcases/block/15_math/itex2mml.html
473
+ - test/testcases/block/15_math/itex2mml.options
474
+ - test/testcases/block/15_math/itex2mml.text
418
475
  - test/testcases/block/15_math/normal.html
419
476
  - test/testcases/block/15_math/normal.text
477
+ - test/testcases/block/15_math/ritex.html
478
+ - test/testcases/block/15_math/ritex.options
479
+ - test/testcases/block/15_math/ritex.text
420
480
  - test/testcases/block/16_toc/no_toc.html
421
481
  - test/testcases/block/16_toc/no_toc.text
422
482
  - test/testcases/block/16_toc/toc_exclude.html
@@ -459,6 +519,9 @@ files:
459
519
  - test/testcases/span/03_codespan/empty.text
460
520
  - test/testcases/span/03_codespan/errors.html
461
521
  - test/testcases/span/03_codespan/errors.text
522
+ - test/testcases/span/03_codespan/highlighting-rouge.html
523
+ - test/testcases/span/03_codespan/highlighting-rouge.options
524
+ - test/testcases/span/03_codespan/highlighting-rouge.text
462
525
  - test/testcases/span/03_codespan/highlighting.html
463
526
  - test/testcases/span/03_codespan/highlighting.text
464
527
  - test/testcases/span/03_codespan/normal.html
@@ -479,6 +542,8 @@ files:
479
542
  - test/testcases/span/04_footnote/placement.text
480
543
  - test/testcases/span/05_html/across_lines.html
481
544
  - test/testcases/span/05_html/across_lines.text
545
+ - test/testcases/span/05_html/button.html
546
+ - test/testcases/span/05_html/button.text
482
547
  - test/testcases/span/05_html/invalid.html
483
548
  - test/testcases/span/05_html/invalid.text
484
549
  - test/testcases/span/05_html/link_with_mailto.html
@@ -510,8 +575,14 @@ files:
510
575
  - test/testcases/span/line_breaks/normal.html
511
576
  - test/testcases/span/line_breaks/normal.latex
512
577
  - test/testcases/span/line_breaks/normal.text
578
+ - test/testcases/span/math/itex2mml.html
579
+ - test/testcases/span/math/itex2mml.options
580
+ - test/testcases/span/math/itex2mml.text
513
581
  - test/testcases/span/math/normal.html
514
582
  - test/testcases/span/math/normal.text
583
+ - test/testcases/span/math/ritex.html
584
+ - test/testcases/span/math/ritex.options
585
+ - test/testcases/span/math/ritex.text
515
586
  - test/testcases/span/text_substitutions/entities.html
516
587
  - test/testcases/span/text_substitutions/entities.options
517
588
  - test/testcases/span/text_substitutions/entities.text
@@ -542,6 +613,8 @@ files:
542
613
  - test/testcases_gfm/backticks_disable_highlighting.text
543
614
  - test/testcases_gfm/backticks_syntax.html
544
615
  - test/testcases_gfm/backticks_syntax.text
616
+ - test/testcases_gfm/hard_line_breaks.html
617
+ - test/testcases_gfm/hard_line_breaks.text
545
618
  - test/testcases_gfm/hard_line_breaks_off.html
546
619
  - test/testcases_gfm/hard_line_breaks_off.options
547
620
  - test/testcases_gfm/hard_line_breaks_off.text