kramdown 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTERS +15 -14
  3. data/README.md +18 -16
  4. data/VERSION +1 -1
  5. data/lib/kramdown/converter/base.rb +1 -1
  6. data/lib/kramdown/converter/hash_ast.rb +1 -1
  7. data/lib/kramdown/converter/html.rb +10 -3
  8. data/lib/kramdown/converter/kramdown.rb +1 -1
  9. data/lib/kramdown/converter/latex.rb +1 -1
  10. data/lib/kramdown/converter/man.rb +1 -1
  11. data/lib/kramdown/converter/math_engine/mathjax.rb +1 -1
  12. data/lib/kramdown/converter/remove_html_tags.rb +1 -1
  13. data/lib/kramdown/converter/syntax_highlighter/minted.rb +1 -1
  14. data/lib/kramdown/converter/syntax_highlighter/rouge.rb +32 -3
  15. data/lib/kramdown/converter/syntax_highlighter.rb +1 -1
  16. data/lib/kramdown/converter/toc.rb +1 -1
  17. data/lib/kramdown/converter.rb +1 -1
  18. data/lib/kramdown/document.rb +1 -1
  19. data/lib/kramdown/element.rb +1 -1
  20. data/lib/kramdown/error.rb +1 -1
  21. data/lib/kramdown/options.rb +22 -3
  22. data/lib/kramdown/parser/base.rb +2 -2
  23. data/lib/kramdown/parser/html.rb +13 -6
  24. data/lib/kramdown/parser/kramdown/abbreviation.rb +2 -2
  25. data/lib/kramdown/parser/kramdown/autolink.rb +1 -1
  26. data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
  27. data/lib/kramdown/parser/kramdown/block_boundary.rb +2 -2
  28. data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
  29. data/lib/kramdown/parser/kramdown/codeblock.rb +2 -2
  30. data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
  31. data/lib/kramdown/parser/kramdown/emphasis.rb +4 -3
  32. data/lib/kramdown/parser/kramdown/eob.rb +1 -1
  33. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  34. data/lib/kramdown/parser/kramdown/extensions.rb +9 -7
  35. data/lib/kramdown/parser/kramdown/footnote.rb +1 -1
  36. data/lib/kramdown/parser/kramdown/header.rb +1 -1
  37. data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
  38. data/lib/kramdown/parser/kramdown/html.rb +8 -6
  39. data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
  40. data/lib/kramdown/parser/kramdown/line_break.rb +1 -1
  41. data/lib/kramdown/parser/kramdown/link.rb +37 -5
  42. data/lib/kramdown/parser/kramdown/list.rb +6 -4
  43. data/lib/kramdown/parser/kramdown/math.rb +1 -1
  44. data/lib/kramdown/parser/kramdown/paragraph.rb +1 -1
  45. data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
  46. data/lib/kramdown/parser/kramdown/table.rb +2 -2
  47. data/lib/kramdown/parser/kramdown/typographic_symbol.rb +1 -1
  48. data/lib/kramdown/parser/kramdown.rb +11 -4
  49. data/lib/kramdown/parser/markdown.rb +1 -1
  50. data/lib/kramdown/parser.rb +1 -1
  51. data/lib/kramdown/utils/configurable.rb +1 -1
  52. data/lib/kramdown/utils/entities.rb +1 -1
  53. data/lib/kramdown/utils/html.rb +1 -1
  54. data/lib/kramdown/utils/lru_cache.rb +1 -1
  55. data/lib/kramdown/utils/string_scanner.rb +8 -9
  56. data/lib/kramdown/utils/unidecoder.rb +1 -1
  57. data/lib/kramdown/utils.rb +1 -1
  58. data/lib/kramdown/version.rb +2 -2
  59. data/lib/kramdown.rb +1 -1
  60. data/man/man1/kramdown.1 +6 -2
  61. data/test/run_tests.rb +1 -1
  62. data/test/test_files.rb +8 -2
  63. data/test/test_location.rb +1 -1
  64. data/test/test_string_scanner_kramdown.rb +1 -1
  65. data/test/testcases/block/04_header/with_custom_header_links.html +1 -0
  66. data/test/testcases/block/04_header/with_custom_header_links.options +4 -0
  67. data/test/testcases/block/04_header/with_custom_header_links.text +1 -0
  68. data/test/testcases/span/01_link/imagelinks.html +4 -0
  69. data/test/testcases/span/01_link/imagelinks.text +7 -0
  70. data/test/testcases/span/01_link/unclosed_brackets.html +5 -0
  71. data/test/testcases/span/01_link/unclosed_brackets.text +5 -0
  72. data/test/testcases/span/04_footnote/empty_definition.html +12 -0
  73. data/test/testcases/span/04_footnote/empty_definition.text +3 -0
  74. metadata +14 -7
data/test/test_files.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8; frozen_string_literal: true -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2026 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -87,6 +87,7 @@ class TestFiles < Minitest::Test
87
87
  'test/testcases/block/09_html/xml.html', # bc of tidy
88
88
  'test/testcases/span/05_html/xml.html', # bc of tidy
89
89
  'test/testcases/block/04_header/with_header_links.html', # because of header_links option
90
+ 'test/testcases/block/04_header/with_custom_header_links.html', # bc of header_links option
90
91
  ].compact
91
92
  EXCLUDE_HTML_TEXT_FILES = [
92
93
  'test/testcases/block/09_html/parse_as_span.htmlinput',
@@ -133,6 +134,7 @@ class TestFiles < Minitest::Test
133
134
  EXCLUDE_LATEX_FILES = [
134
135
  'test/testcases/span/01_link/image_in_a.text', # bc of image link
135
136
  'test/testcases/span/01_link/imagelinks.text', # bc of image links
137
+ 'test/testcases/span/01_link/unclosed_brackets.text', # bc of image links
136
138
  'test/testcases/span/01_link/empty_title.text',
137
139
  'test/testcases/span/04_footnote/markers.text', # bc of footnote in header
138
140
  'test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.text',
@@ -187,6 +189,7 @@ class TestFiles < Minitest::Test
187
189
  'test/testcases/cjk-line-break.text',
188
190
  'test/testcases/block/09_html/standalone_image_in_div.html', # bc of standalone image
189
191
  'test/testcases/span/abbreviations/abbrev_in_html.text', # bc of invalid abbr tag in SVG
192
+ 'test/testcases/span/01_link/imagelinks.text', # bc of attribute ordering
190
193
  ].compact
191
194
  Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
192
195
  next if EXCLUDE_TEXT_FILES.any? {|f| text_file =~ /#{f}$/ }
@@ -243,6 +246,8 @@ class TestFiles < Minitest::Test
243
246
  'test/testcases/block/09_html/standalone_image_in_div.html', # bc of standalone image
244
247
  'test/testcases/block/09_html/processing_instruction.html', # bc of PI
245
248
  'test/testcases/block/04_header/with_header_links.html', # bc of header_links option
249
+ 'test/testcases/block/04_header/with_custom_header_links.html', # bc of header_links option
250
+ 'test/testcases/span/01_link/imagelinks.html', # bc of attribute ordering
246
251
  ].compact
247
252
  Dir[File.dirname(__FILE__) + '/testcases/**/*.html'].each do |html_file|
248
253
  next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}$/ }
@@ -260,7 +265,7 @@ class TestFiles < Minitest::Test
260
265
 
261
266
  # Generate test methods for text-manpage conversion
262
267
  Dir[File.dirname(__FILE__) + '/testcases/man/**/*.text'].each do |text_file|
263
- define_method('test_' + text_file.tr('.', '_') + "_to_man") do
268
+ define_method('test_' + text_file.tr('.', '_') + "_to_man_extra") do
264
269
  man_file = text_file.sub(/\.text$/, '.man')
265
270
  doc = Kramdown::Document.new(File.read(text_file))
266
271
  assert_equal(File.read(man_file), doc.to_man)
@@ -270,6 +275,7 @@ class TestFiles < Minitest::Test
270
275
  EXCLUDE_MODIFY = [
271
276
  'test/testcases/block/06_codeblock/rouge/multiple.text', # bc of HTMLFormater in options
272
277
  'test/testcases/block/04_header/with_header_links.text', # bc of header_links option
278
+ 'test/testcases/block/04_header/with_custom_header_links.text', # bc of header_links option
273
279
  ].compact
274
280
 
275
281
  # Generate test methods for asserting that converters don't modify the document tree.
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8; frozen_string_literal: true -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2026 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8; frozen_string_literal: true -*-
2
2
  #
3
3
  #--
4
- # Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
4
+ # Copyright (C) 2009-2026 Thomas Leitner <t_leitner@gmx.at>
5
5
  #
6
6
  # This file is part of kramdown which is licensed under the MIT.
7
7
  #++
@@ -0,0 +1 @@
1
+ <h1 id="header">This is a header<a href="#header">Link</a></h1>
@@ -0,0 +1,4 @@
1
+ :header_links:
2
+ content: 'Link'
3
+ position: end
4
+ :auto_ids: false
@@ -0,0 +1 @@
1
+ # This is a header {#header}
@@ -13,3 +13,7 @@
13
13
  <p>No id: <img src="other.png" alt="imgo" title="Title" /></p>
14
14
 
15
15
  <p>With escaped pipe: <img src="other.png" alt="an | pipe" /></p>
16
+
17
+ <p>Inline alt text override <img src="other.png" alt="Alt override" />
18
+ Referenced alt text override <img alt="Alt override" src="otherref.png" /></p>
19
+
@@ -16,3 +16,10 @@ No id: ![imgo]
16
16
  [imgo]: other.png "Title"
17
17
 
18
18
  With escaped pipe: ![an \| pipe](other.png)
19
+
20
+
21
+ Inline alt text override ![alt text](other.png){:alt="Alt override"}
22
+ Referenced alt text override ![alttext]
23
+
24
+ [alttext]: otherref.png
25
+ {:alt="Alt override"}
@@ -0,0 +1,5 @@
1
+ <p>[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ some [text] and [<a href="url">a link</a></p>
2
+
3
+ <p>![![![![![![![![![![![![![![![![![ some ![text and <img src="img.png" alt="an image" /></p>
4
+
5
+ <p>[ <a href="url"> <em>[</em> </a> and ![ *x <img src="img.png" alt="* " /></p>
@@ -0,0 +1,5 @@
1
+ [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[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link](url)
2
+
3
+ ![![![![![![![![![![![![![![![![![ some ![text and ![an image](img.png)
4
+
5
+ [ [ *[* ](url) and ![ *x ![* ](img.png)
@@ -0,0 +1,12 @@
1
+ <p>A<sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> B<sup id="fnref:2"><a href="#fn:2" class="footnote" rel="footnote" role="doc-noteref">2</a></sup></p>
2
+
3
+ <div class="footnotes" role="doc-endnotes">
4
+ <ol>
5
+ <li id="fn:1">
6
+ <p><a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
7
+ </li>
8
+ <li id="fn:2">
9
+ <p>Note text 2 <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
10
+ </li>
11
+ </ol>
12
+ </div>
@@ -0,0 +1,3 @@
1
+ A[^1] B[^2]
2
+
3
+ [^1]: [^2]: Note text 2
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: 2.5.1
4
+ version: 2.6.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: 2024-11-18 00:00:00.000000000 Z
11
+ date: 2026-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rexml
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.9
19
+ version: 3.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.3.9
26
+ version: 3.4.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '6.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.0'
40
+ version: '6.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rouge
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +199,9 @@ files:
199
199
  - test/testcases/block/04_header/with_auto_ids.html
200
200
  - test/testcases/block/04_header/with_auto_ids.options
201
201
  - test/testcases/block/04_header/with_auto_ids.text
202
+ - test/testcases/block/04_header/with_custom_header_links.html
203
+ - test/testcases/block/04_header/with_custom_header_links.options
204
+ - test/testcases/block/04_header/with_custom_header_links.text
202
205
  - test/testcases/block/04_header/with_header_links.html
203
206
  - test/testcases/block/04_header/with_header_links.options
204
207
  - test/testcases/block/04_header/with_header_links.text
@@ -517,6 +520,8 @@ files:
517
520
  - test/testcases/span/01_link/reference.html
518
521
  - test/testcases/span/01_link/reference.options
519
522
  - test/testcases/span/01_link/reference.text
523
+ - test/testcases/span/01_link/unclosed_brackets.html
524
+ - test/testcases/span/01_link/unclosed_brackets.text
520
525
  - test/testcases/span/02_emphasis/empty.html
521
526
  - test/testcases/span/02_emphasis/empty.text
522
527
  - test/testcases/span/02_emphasis/errors.html
@@ -555,6 +560,8 @@ files:
555
560
  - test/testcases/span/04_footnote/definitions.html
556
561
  - test/testcases/span/04_footnote/definitions.latex
557
562
  - test/testcases/span/04_footnote/definitions.text
563
+ - test/testcases/span/04_footnote/empty_definition.html
564
+ - test/testcases/span/04_footnote/empty_definition.text
558
565
  - test/testcases/span/04_footnote/footnote_link_text.html
559
566
  - test/testcases/span/04_footnote/footnote_link_text.options
560
567
  - test/testcases/span/04_footnote/footnote_link_text.text
@@ -675,7 +682,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
675
682
  - !ruby/object:Gem::Version
676
683
  version: '0'
677
684
  requirements: []
678
- rubygems_version: 3.5.3
685
+ rubygems_version: 3.5.22
679
686
  signing_key:
680
687
  specification_version: 4
681
688
  summary: kramdown is a fast, pure-Ruby Markdown-superset converter.