kramdown 2.5.2 → 2.6.1
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.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +2 -1
- data/README.md +18 -16
- data/VERSION +1 -1
- data/lib/kramdown/converter/html.rb +9 -2
- data/lib/kramdown/converter/syntax_highlighter/rouge.rb +31 -2
- data/lib/kramdown/options.rb +21 -2
- data/lib/kramdown/parser/base.rb +1 -1
- data/lib/kramdown/parser/html.rb +12 -5
- data/lib/kramdown/parser/kramdown/abbreviation.rb +1 -1
- data/lib/kramdown/parser/kramdown/block_boundary.rb +1 -1
- data/lib/kramdown/parser/kramdown/codeblock.rb +1 -1
- data/lib/kramdown/parser/kramdown/emphasis.rb +3 -2
- data/lib/kramdown/parser/kramdown/extensions.rb +8 -6
- data/lib/kramdown/parser/kramdown/html.rb +8 -5
- data/lib/kramdown/parser/kramdown/link.rb +36 -4
- data/lib/kramdown/parser/kramdown/list.rb +5 -3
- data/lib/kramdown/parser/kramdown/table.rb +1 -1
- data/lib/kramdown/parser/kramdown.rb +10 -3
- data/lib/kramdown/utils/string_scanner.rb +7 -8
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +6 -2
- data/test/test_files.rb +6 -0
- data/test/testcases/block/04_header/with_custom_header_links.html +1 -0
- data/test/testcases/block/04_header/with_custom_header_links.options +4 -0
- data/test/testcases/block/04_header/with_custom_header_links.text +1 -0
- data/test/testcases/span/01_link/imagelinks.html +4 -0
- data/test/testcases/span/01_link/imagelinks.text +7 -0
- data/test/testcases/span/01_link/unclosed_brackets.html +5 -0
- data/test/testcases/span/01_link/unclosed_brackets.text +5 -0
- data/test/testcases/span/04_footnote/empty_definition.html +12 -0
- data/test/testcases/span/04_footnote/empty_definition.text +3 -0
- metadata +13 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 283b5e87eb67e0fa43e331140f7b73d24a3cc4fe96ee593a5676b0750d84213b
|
|
4
|
+
data.tar.gz: 7bde420c5b9b757cfb01a4a86d349bec6b550308422a906061a6f07690c726c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0df3d7afa297c0c389429c18edab21a262af3166bebd435ed9b7274b5487bfc7e64b027a4567b1d342b7504b5376e27cb084679421c655fa0415b566e4d44b84
|
|
7
|
+
data.tar.gz: 67a924df2c1bb8e7490c512d05b9aa76b7bf18a9598534c4cb4f8196a252017956eab9aa37b4add92ec61da87750b54544d0aa5f9547c79149ea2d0580ef8ebd
|
data/CONTRIBUTERS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Count Name
|
|
2
2
|
======= ====
|
|
3
|
-
|
|
3
|
+
1010 Thomas Leitner <t_leitner@gmx.at>
|
|
4
4
|
18 Ashwin Maroli <ashmaroli@gmail.com>
|
|
5
5
|
7 Christian Cornelssen <ccorn@1tein.de>
|
|
6
6
|
6 Gioele Barabucci <gioele@svario.it>
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
2 Jo Hund <jhund@clearcove.ca>
|
|
24
24
|
2 Bryce Willey <Bryce.Steven.Willey@gmail.com>
|
|
25
25
|
2 Bran <m.versum@gmail.com>
|
|
26
|
+
1 youdie006 <xncb135@korea.ac.kr>
|
|
26
27
|
1 winniehell <git@winniehell.de>
|
|
27
28
|
1 utenmiki <utenmiki@gmail.com>
|
|
28
29
|
1 tomykaira <tomykaira@gmail.com>
|
data/README.md
CHANGED
|
@@ -2,18 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Readme first!
|
|
4
4
|
|
|
5
|
-
kramdown was originally licensed under the GPL until the 1.0.0 release. However, due to the many
|
|
6
|
-
requests it is now released under the MIT license and therefore can easily be used in commercial
|
|
7
|
-
projects, too.
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
changes** for the benefit of the community and/or [**becoming a
|
|
11
|
-
sponsor**](https://github.com/sponsors/gettalong/) or [**a
|
|
12
|
-
patron**](https://www.patreon.com/gettalong) - thanks!
|
|
6
|
+
## Sponsors
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* **GROSSWEBER** provides <a href="http://grossweber.com/b/kramdown" target="_blank">software
|
|
8
|
+
* **GROSSWEBER** provides <a href="https://grossweber.com/b/kramdown" target="_blank">software
|
|
17
9
|
development consulting and training services</a>.
|
|
18
10
|
|
|
19
11
|
|
|
@@ -23,8 +15,8 @@ kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax
|
|
|
23
15
|
supporting several common extensions.
|
|
24
16
|
|
|
25
17
|
The syntax definition for the kramdown syntax can be found in **doc/syntax.page** (or online at
|
|
26
|
-
<
|
|
27
|
-
**doc/quickref.page** or online at <
|
|
18
|
+
<https://kramdown.gettalong.org/syntax.html>) and a quick reference is available in
|
|
19
|
+
**doc/quickref.page** or online at <https://kramdown.gettalong.org/quickref.html>.
|
|
28
20
|
|
|
29
21
|
The kramdown library is mainly written to support the kramdown-to-HTML conversion chain. However,
|
|
30
22
|
due to its flexibility (by creating an internal AST) it supports other input and output formats as
|
|
@@ -34,14 +26,14 @@ well. Here is a list of the supported formats:
|
|
|
34
26
|
* output formats: HTML, kramdown, LaTeX (and therefore PDF), PDF via Prawn
|
|
35
27
|
|
|
36
28
|
All the documentation on the available input and output formats is available in the **doc/**
|
|
37
|
-
directory and online at <
|
|
29
|
+
directory and online at <https://kramdown.gettalong.org>.
|
|
38
30
|
|
|
39
31
|
Starting from version 1.0.0 kramdown is using a versioning scheme with major, minor and patch parts
|
|
40
32
|
in the version number where the major number changes on backwards-incompatible changes, the minor
|
|
41
33
|
number on the introduction of new features and the patch number on everything else.
|
|
42
34
|
|
|
43
35
|
For information about changes between versions, have a look at
|
|
44
|
-
<
|
|
36
|
+
<https://kramdown.gettalong.org/news.html> or the commit history!
|
|
45
37
|
|
|
46
38
|
|
|
47
39
|
## Usage
|
|
@@ -56,8 +48,8 @@ Kramdown::Document.new(text).to_html
|
|
|
56
48
|
|
|
57
49
|
For detailed information have a look at the API documentation of the `Kramdown::Document` class.
|
|
58
50
|
|
|
59
|
-
The full API documentation is available at <
|
|
60
|
-
API documentation for kramdown probably don't provide the complete documentation!
|
|
51
|
+
The full API documentation is available at <https://kramdown.gettalong.org/rdoc/>, other sites with
|
|
52
|
+
an API documentation for kramdown probably don't provide the complete documentation!
|
|
61
53
|
|
|
62
54
|
There are also some third-party libraries that extend the functionality of kramdown -- see the
|
|
63
55
|
kramdown Wiki at <https://github.com/gettalong/kramdown/wiki>.
|
|
@@ -75,3 +67,13 @@ programs like `tidy` and `latex`. See the `.travis.yml` file for more informatio
|
|
|
75
67
|
## License
|
|
76
68
|
|
|
77
69
|
MIT - see the **COPYING** file.
|
|
70
|
+
|
|
71
|
+
kramdown was originally licensed under the GPL until the 1.0.0 release. However, due to the many
|
|
72
|
+
requests it is now released under the MIT license and therefore can easily be used in commercial
|
|
73
|
+
projects, too.
|
|
74
|
+
|
|
75
|
+
However, if you use kramdown in a commercial setting, please consider **contributing back any
|
|
76
|
+
changes** for the benefit of the community and/or [**becoming a
|
|
77
|
+
sponsor**](https://github.com/sponsors/gettalong/) or [**a
|
|
78
|
+
patron**](https://www.patreon.com/gettalong) - thanks!
|
|
79
|
+
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.6.1
|
|
@@ -155,7 +155,14 @@ module Kramdown
|
|
|
155
155
|
if @options[:header_links] && attr['id'].to_s.length > 0
|
|
156
156
|
link = Element.new(:a, nil, nil)
|
|
157
157
|
link.attr['href'] = "##{attr['id']}"
|
|
158
|
-
|
|
158
|
+
unless (header_link_text = @options[:header_links][:content].to_s).empty?
|
|
159
|
+
link.children << Element.new(:text, header_link_text)
|
|
160
|
+
end
|
|
161
|
+
if @options[:header_links][:position].to_s == 'start'
|
|
162
|
+
el.children.unshift(link)
|
|
163
|
+
else
|
|
164
|
+
el.children.push(link)
|
|
165
|
+
end
|
|
159
166
|
end
|
|
160
167
|
|
|
161
168
|
@toc << [el.options[:level], attr['id'], el.children] if attr['id'] && in_toc?(el)
|
|
@@ -504,7 +511,7 @@ module Kramdown
|
|
|
504
511
|
li.children = Marshal.load(Marshal.dump(data.children))
|
|
505
512
|
|
|
506
513
|
para = nil
|
|
507
|
-
if li.children.last
|
|
514
|
+
if li.children.last&.type == :p || @options[:footnote_backlink_inline]
|
|
508
515
|
parent = li
|
|
509
516
|
while !parent.children.empty? && ![:p, :header].include?(parent.children.last.type)
|
|
510
517
|
parent = parent.children.last
|
|
@@ -17,6 +17,36 @@ module Kramdown::Converter::SyntaxHighlighter
|
|
|
17
17
|
|
|
18
18
|
# Highlighting via Rouge is available if this constant is +true+.
|
|
19
19
|
AVAILABLE = true
|
|
20
|
+
|
|
21
|
+
# This is the HTMLLegacy implementation from Rouge that is deprecated. Therefore it is
|
|
22
|
+
# reproduced here and only adapted as needed.
|
|
23
|
+
class HTMLLegacy < ::Rouge::Formatter
|
|
24
|
+
def initialize(opts = {})
|
|
25
|
+
@formatter = if opts[:inline_theme]
|
|
26
|
+
::Rouge::Formatters::HTMLInline.new(opts[:inline_theme])
|
|
27
|
+
else
|
|
28
|
+
::Rouge::Formatters::HTML.new
|
|
29
|
+
end
|
|
30
|
+
@formatter = ::Rouge::Formatters::HTMLTable.new(@formatter, opts) if opts[:line_numbers]
|
|
31
|
+
|
|
32
|
+
if opts.fetch(:wrap, true)
|
|
33
|
+
@pygments_wrap = opts.fetch(:css_class, 'codehilite')
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def stream(tokens, &b)
|
|
38
|
+
if @pygments_wrap
|
|
39
|
+
yield %(<div class="highlight"><pre class="#{@pygments_wrap}"><code>)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
@formatter.stream(tokens, &b)
|
|
43
|
+
|
|
44
|
+
if @pygments_wrap
|
|
45
|
+
yield "</code></pre></div>"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
20
50
|
rescue LoadError, SyntaxError
|
|
21
51
|
AVAILABLE = false # :nodoc:
|
|
22
52
|
end
|
|
@@ -72,8 +102,7 @@ module Kramdown::Converter::SyntaxHighlighter
|
|
|
72
102
|
when /\A[[:upper:]][[:alnum:]_]*\z/
|
|
73
103
|
::Rouge::Formatters.const_get(formatter, false)
|
|
74
104
|
else
|
|
75
|
-
|
|
76
|
-
::Rouge::Formatters::HTMLLegacy
|
|
105
|
+
HTMLLegacy
|
|
77
106
|
end
|
|
78
107
|
rescue NameError
|
|
79
108
|
# Fallback to Rouge 1.x
|
data/lib/kramdown/options.rb
CHANGED
|
@@ -236,14 +236,33 @@ module Kramdown
|
|
|
236
236
|
Used by: HTML/Latex converter
|
|
237
237
|
EOF
|
|
238
238
|
|
|
239
|
-
define(:header_links,
|
|
239
|
+
define(:header_links, Object, false, <<~EOF) do |val|
|
|
240
240
|
Adds anchor tags within headers that can be used to generate permalinks
|
|
241
241
|
when not using a table of contents.
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
If the value is `false`, no header links are used; if `true`, the defaults
|
|
244
|
+
are used: The anchor tags are empty and at the start of the header element.
|
|
245
|
+
This can be changed by using a hash as value with the following symbol keys:
|
|
246
|
+
|
|
247
|
+
* content: Defines the content of the anchor tag, default is ''.
|
|
248
|
+
* position: Whether the anchor tag is placed at the 'start' or the 'end' of
|
|
249
|
+
the header tag, default is 'start'.
|
|
244
250
|
|
|
245
251
|
Default: false
|
|
246
252
|
EOF
|
|
253
|
+
case val
|
|
254
|
+
when FalseClass
|
|
255
|
+
val
|
|
256
|
+
when TrueClass
|
|
257
|
+
{content: '', position: :start}
|
|
258
|
+
else
|
|
259
|
+
val = simple_hash_validator(val, :header_links)
|
|
260
|
+
val.keys.each do |k|
|
|
261
|
+
val[k.kind_of?(String) ? str_to_sym(k) : k] = val.delete(k)
|
|
262
|
+
end
|
|
263
|
+
val
|
|
264
|
+
end
|
|
265
|
+
end
|
|
247
266
|
|
|
248
267
|
define(:transliterated_header_ids, Boolean, false, <<~EOF)
|
|
249
268
|
Transliterate the header text before generating the ID
|
data/lib/kramdown/parser/base.rb
CHANGED
|
@@ -57,7 +57,7 @@ module Kramdown
|
|
|
57
57
|
|
|
58
58
|
@root.options[:abbrev_defs].default_proc = @root.options[:abbrev_attr].default_proc =
|
|
59
59
|
lambda do |h, k|
|
|
60
|
-
k_mod = k.gsub(/[\
|
|
60
|
+
k_mod = k.gsub(/[\p{Z}\t\r\n\f\v]+/m, " ")
|
|
61
61
|
k != k_mod ? h[k_mod] : nil
|
|
62
62
|
end
|
|
63
63
|
@warnings = []
|
data/lib/kramdown/parser/html.rb
CHANGED
|
@@ -73,8 +73,8 @@ module Kramdown
|
|
|
73
73
|
|
|
74
74
|
# Contains the parsing methods. This module can be mixed into any parser to get HTML parsing
|
|
75
75
|
# functionality. The only thing that must be provided by the class are instance variable
|
|
76
|
-
# @stack for storing the needed state
|
|
77
|
-
# parsing.
|
|
76
|
+
# @stack for storing the needed state, @src (instance of StringScanner) for the actual
|
|
77
|
+
# parsing and @stack_counter for checking nested element level.
|
|
78
78
|
module Parser
|
|
79
79
|
|
|
80
80
|
include Constants
|
|
@@ -149,6 +149,8 @@ module Kramdown
|
|
|
149
149
|
# When an HTML start tag is found, processing is deferred to #handle_html_start_tag,
|
|
150
150
|
# providing the block given to this method.
|
|
151
151
|
def parse_raw_html(el, &block)
|
|
152
|
+
@stack_counter += 1
|
|
153
|
+
raise Kramdown::Error, "Elements nested too deep at HTML raw level" if @stack_counter > 200
|
|
152
154
|
@stack.push(@tree)
|
|
153
155
|
@tree = el
|
|
154
156
|
|
|
@@ -157,11 +159,14 @@ module Kramdown
|
|
|
157
159
|
if (result = @src.scan_until(HTML_RAW_START))
|
|
158
160
|
add_text(result, @tree, :text)
|
|
159
161
|
line = @src.current_line_number
|
|
160
|
-
if (
|
|
162
|
+
if @src.skip(/<!--/) && (r = @src.exist?(/-->/); @src.pos -= 4; r)
|
|
163
|
+
result = @src.scan(HTML_COMMENT_RE)
|
|
161
164
|
@tree.children << Element.new(:xml_comment, result, nil, category: :block, location: line)
|
|
162
|
-
elsif (
|
|
165
|
+
elsif @src.skip(/<\?/) && (r = @src.exist?(/\?>/); @src.pos -= 2; r)
|
|
166
|
+
result = @src.scan(HTML_INSTRUCTION_RE)
|
|
163
167
|
@tree.children << Element.new(:xml_pi, result, nil, category: :block, location: line)
|
|
164
|
-
elsif @src.
|
|
168
|
+
elsif @src.skip(/<!\[CDATA\[/) && (r = @src.exist?(/\]\]>/); @src.pos -= 9; r)
|
|
169
|
+
@src.scan(HTML_CDATA_RE)
|
|
165
170
|
@tree.children << Element.new(:text, @src[1], nil, cdata: true, location: line)
|
|
166
171
|
elsif @src.scan(HTML_TAG_RE)
|
|
167
172
|
if method(:handle_html_start_tag).arity.abs >= 1
|
|
@@ -191,6 +196,7 @@ module Kramdown
|
|
|
191
196
|
end
|
|
192
197
|
end
|
|
193
198
|
|
|
199
|
+
@stack_counter -= 1
|
|
194
200
|
@tree = @stack.pop
|
|
195
201
|
end
|
|
196
202
|
|
|
@@ -591,6 +597,7 @@ module Kramdown
|
|
|
591
597
|
|
|
592
598
|
# Parse the source string provided on initialization as HTML document.
|
|
593
599
|
def parse
|
|
600
|
+
@stack_counter = 0
|
|
594
601
|
@stack, @tree = [], @root
|
|
595
602
|
@src = Kramdown::Utils::StringScanner.new(adapt_source(source))
|
|
596
603
|
|
|
@@ -43,7 +43,7 @@ module Kramdown
|
|
|
43
43
|
unless regexps
|
|
44
44
|
sorted_abbrevs = @root.options[:abbrev_defs].keys.sort {|a, b| b.length <=> a.length }
|
|
45
45
|
regexps = [Regexp.union(*sorted_abbrevs.map do |k|
|
|
46
|
-
/#{Regexp.escape(k).gsub(/\\\s/, "[\\
|
|
46
|
+
/#{Regexp.escape(k).gsub(/\\\s/, "[\\t\\r\\n\\f\\v\\p{Z}]+").force_encoding(Encoding::UTF_8)}/
|
|
47
47
|
end)]
|
|
48
48
|
regexps << /(?=(?:\W|^)#{regexps.first}(?!\w))/ # regexp should only match on word boundaries
|
|
49
49
|
end
|
|
@@ -35,7 +35,7 @@ module Kramdown
|
|
|
35
35
|
|
|
36
36
|
# Parse the fenced codeblock at the current location.
|
|
37
37
|
def parse_codeblock_fenced
|
|
38
|
-
if @src.
|
|
38
|
+
if @src.match?(self.class::FENCED_CODEBLOCK_MATCH)
|
|
39
39
|
start_line_number = @src.current_line_number
|
|
40
40
|
@src.pos += @src.matched_size
|
|
41
41
|
el = new_block_el(:codeblock, @src[5], nil, location: start_line_number, fenced: true)
|
|
@@ -22,8 +22,9 @@ module Kramdown
|
|
|
22
22
|
element = (result.length == 2 ? :strong : :em)
|
|
23
23
|
type = result[0..0]
|
|
24
24
|
|
|
25
|
-
if (type == '_' && @src.pre_match
|
|
26
|
-
|
|
25
|
+
if (type == '_' && (tmp = @src.pre_match).match?(/[[:alnum:]]-?[[:alnum:]]*_*\z/, [tmp.size - 50, 0].max)) ||
|
|
26
|
+
@src.match?(/\s/) ||
|
|
27
|
+
@tree.type == element || @stack.any? {|el, _| el.type == element }
|
|
27
28
|
add_text(result)
|
|
28
29
|
return
|
|
29
30
|
end
|
|
@@ -18,7 +18,7 @@ module Kramdown
|
|
|
18
18
|
def parse_attribute_list(str, opts)
|
|
19
19
|
return if str.strip.empty? || str.strip == ':'
|
|
20
20
|
attrs = str.scan(ALD_TYPE_ANY)
|
|
21
|
-
attrs.each do |key, sep, val, ref, id_and_or_class, _, _|
|
|
21
|
+
attrs.each do |key, sep, val, ref, id_and_or_class, _, _, unmatched|
|
|
22
22
|
if ref
|
|
23
23
|
(opts[:refs] ||= []) << ref
|
|
24
24
|
elsif id_and_or_class
|
|
@@ -29,6 +29,8 @@ module Kramdown
|
|
|
29
29
|
opts['id'] = id_attr
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
|
+
elsif unmatched
|
|
33
|
+
warning("IAL/ALD contains invalid part: #{unmatched}")
|
|
32
34
|
else
|
|
33
35
|
val.gsub!(/\\(\}|#{sep})/, "\\1")
|
|
34
36
|
opts[key] = val
|
|
@@ -146,7 +148,7 @@ module Kramdown
|
|
|
146
148
|
ALD_TYPE_ID_OR_CLASS = /#{ALD_TYPE_ID_NAME}|#{ALD_TYPE_CLASS_NAME}/
|
|
147
149
|
ALD_TYPE_ID_OR_CLASS_MULTI = /((?:#{ALD_TYPE_ID_NAME}|#{ALD_TYPE_CLASS_NAME})+)/
|
|
148
150
|
ALD_TYPE_REF = /(#{ALD_ID_NAME})/
|
|
149
|
-
ALD_TYPE_ANY = /(?:\A|\s)(?:#{ALD_TYPE_KEY_VALUE_PAIR}|#{ALD_TYPE_REF}|#{ALD_TYPE_ID_OR_CLASS_MULTI})(?=\s|\Z)/
|
|
151
|
+
ALD_TYPE_ANY = /(?:\A|\s)(?:#{ALD_TYPE_KEY_VALUE_PAIR}|#{ALD_TYPE_REF}|#{ALD_TYPE_ID_OR_CLASS_MULTI}|(\S+))(?=\s|\Z)/
|
|
150
152
|
ALD_START = /^#{OPT_SPACE}\{:(#{ALD_ID_NAME}):(#{ALD_ANY_CHARS}+)\}\s*?\n/
|
|
151
153
|
|
|
152
154
|
EXT_STOP_STR = "\\{:/(%s)?\\}"
|
|
@@ -166,14 +168,14 @@ module Kramdown
|
|
|
166
168
|
parse_attribute_list(@src[2], @alds[@src[1]] ||= {})
|
|
167
169
|
@tree.children << new_block_el(:eob, :ald)
|
|
168
170
|
true
|
|
169
|
-
elsif @src.
|
|
171
|
+
elsif @src.match?(EXT_BLOCK_START)
|
|
170
172
|
parse_extension_start_tag(:block)
|
|
171
173
|
elsif @src.scan(IAL_BLOCK_START)
|
|
172
174
|
if (last_child = @tree.children.last) && last_child.type != :blank &&
|
|
173
175
|
(last_child.type != :eob ||
|
|
174
176
|
[:link_def, :abbrev_def, :footnote_def].include?(last_child.value))
|
|
175
177
|
parse_attribute_list(@src[1], last_child.options[:ial] ||= {})
|
|
176
|
-
@tree.children << new_block_el(:eob, :ial) unless @src.
|
|
178
|
+
@tree.children << new_block_el(:eob, :ial) unless @src.match?(IAL_BLOCK_START)
|
|
177
179
|
else
|
|
178
180
|
parse_attribute_list(@src[1], @block_ial ||= {})
|
|
179
181
|
end
|
|
@@ -190,9 +192,9 @@ module Kramdown
|
|
|
190
192
|
|
|
191
193
|
# Parse the extension span at the current location.
|
|
192
194
|
def parse_span_extensions
|
|
193
|
-
if @src.
|
|
195
|
+
if @src.match?(EXT_SPAN_START)
|
|
194
196
|
parse_extension_start_tag(:span)
|
|
195
|
-
elsif @src.
|
|
197
|
+
elsif @src.match?(IAL_SPAN_START)
|
|
196
198
|
if (last_child = @tree.children.last) && last_child.type != :text
|
|
197
199
|
@src.pos += @src.matched_size
|
|
198
200
|
attr = {}
|
|
@@ -72,16 +72,17 @@ module Kramdown
|
|
|
72
72
|
# Parse the HTML at the current position as block-level HTML.
|
|
73
73
|
def parse_block_html
|
|
74
74
|
line = @src.current_line_number
|
|
75
|
-
if (
|
|
75
|
+
if @src.skip(/<!--/) && (r = @src.exist?(/-->/); @src.pos -= 4; r)
|
|
76
|
+
result = @src.scan(HTML_COMMENT_RE)
|
|
76
77
|
@tree.children << Element.new(:xml_comment, result, nil, category: :block, location: line)
|
|
77
78
|
@src.scan(TRAILING_WHITESPACE)
|
|
78
79
|
true
|
|
79
|
-
elsif @src.
|
|
80
|
+
elsif @src.match?(/^#{OPT_SPACE}#{HTML_TAG_RE}/o) && !HTML_SPAN_ELEMENTS.include?(@src[1].downcase)
|
|
80
81
|
@src.pos += @src.matched_size
|
|
81
82
|
handle_html_start_tag(line) {|iel, ic, ih| handle_kramdown_html_tag(iel, ic, ih) }
|
|
82
83
|
Kramdown::Parser::Html::ElementConverter.convert(@root, @tree.children.last) if @options[:html_to_native]
|
|
83
84
|
true
|
|
84
|
-
elsif @src.
|
|
85
|
+
elsif @src.match?(/^#{OPT_SPACE}#{HTML_TAG_CLOSE_RE}/o) && !HTML_SPAN_ELEMENTS.include?(@src[1].downcase)
|
|
85
86
|
name = @src[1].downcase
|
|
86
87
|
|
|
87
88
|
if @tree.type == :html_element && @tree.value == name
|
|
@@ -101,9 +102,11 @@ module Kramdown
|
|
|
101
102
|
# Parse the HTML at the current position as span-level HTML.
|
|
102
103
|
def parse_span_html
|
|
103
104
|
line = @src.current_line_number
|
|
104
|
-
if (
|
|
105
|
+
if @src.skip(/<!--/) && (r = @src.exist?(/-->/); @src.pos -= 4; r)
|
|
106
|
+
result = @src.scan(HTML_COMMENT_RE)
|
|
105
107
|
@tree.children << Element.new(:xml_comment, result, nil, category: :span, location: line)
|
|
106
|
-
elsif @src.
|
|
108
|
+
elsif @src.skip(/<!\[CDATA\[/) && (r = @src.exist?(/\]\]>/); @src.pos -= 9; r)
|
|
109
|
+
@src.scan(HTML_CDATA_RE)
|
|
107
110
|
add_text(escape_html(@src[1]))
|
|
108
111
|
elsif (result = @src.scan(HTML_TAG_CLOSE_RE))
|
|
109
112
|
warning("Found invalidly used HTML closing tag for '#{@src[1]}' on line #{line}")
|
|
@@ -43,7 +43,7 @@ module Kramdown
|
|
|
43
43
|
el.attr['href'] = href
|
|
44
44
|
else
|
|
45
45
|
el.attr['src'] = href
|
|
46
|
-
el.attr['alt']
|
|
46
|
+
el.attr['alt'] ||= alt_text
|
|
47
47
|
el.children.clear
|
|
48
48
|
end
|
|
49
49
|
el.attr['title'] = title if title
|
|
@@ -55,11 +55,13 @@ module Kramdown
|
|
|
55
55
|
LINK_INLINE_ID_RE = /\s*?\[([^\]]+)?\]/
|
|
56
56
|
LINK_INLINE_TITLE_RE = /\s*?(["'])(.+?)\1\s*?\)/m
|
|
57
57
|
LINK_START = /!?\[(?=[^^])/
|
|
58
|
+
LINK_EMPHASIS_CONTEXT = Hash.new(0).merge!(em: 1, strong: 2).freeze
|
|
58
59
|
|
|
59
60
|
# Parse the link at the current scanner position. This method is used to parse normal links as
|
|
60
61
|
# well as image links.
|
|
61
62
|
def parse_link
|
|
62
63
|
start_line_number = @src.current_line_number
|
|
64
|
+
start_pos = @src.pos
|
|
63
65
|
result = @src.scan(LINK_START)
|
|
64
66
|
cur_pos = @src.pos
|
|
65
67
|
saved_pos = @src.save_pos
|
|
@@ -72,15 +74,45 @@ module Kramdown
|
|
|
72
74
|
add_text(result)
|
|
73
75
|
return
|
|
74
76
|
end
|
|
77
|
+
|
|
78
|
+
# Failed bracket scans are cached per source position to avoid quadratic or even exponential
|
|
79
|
+
# runtime on unclosed brackets. Since the scan result depends on whether emphasis may be
|
|
80
|
+
# parsed, the emphasis context (stored in the two lowest bits) is part of the cache key.
|
|
81
|
+
unless @link_scan_failures_src.equal?(@src)
|
|
82
|
+
@link_scan_failures_src, @link_scan_failures = @src, {}
|
|
83
|
+
end
|
|
84
|
+
context = @stack.inject(LINK_EMPHASIS_CONTEXT[@tree.type]) do |memo, (t, _)|
|
|
85
|
+
memo | LINK_EMPHASIS_CONTEXT[t&.type]
|
|
86
|
+
end
|
|
87
|
+
start_key = (start_pos << 2) | context
|
|
88
|
+
if @link_scan_failures[start_key]
|
|
89
|
+
@src.terminate if @tree.type == :a || @tree.type == :img
|
|
90
|
+
add_text(result)
|
|
91
|
+
return
|
|
92
|
+
end
|
|
93
|
+
|
|
75
94
|
el = Element.new(link_type, nil, nil, location: start_line_number)
|
|
76
95
|
|
|
77
96
|
count = 1
|
|
97
|
+
brackets = []
|
|
78
98
|
found = parse_spans(el, LINK_BRACKET_STOP_RE) do
|
|
79
|
-
|
|
80
|
-
count
|
|
99
|
+
closing = @src[1]
|
|
100
|
+
count += (closing ? -1 : 1)
|
|
101
|
+
level = count - el.children.count {|c| c.type == :img }
|
|
102
|
+
brackets << [(closing || @src.matched_size == 2) ? nil : @src.pos, level]
|
|
103
|
+
level == 0
|
|
81
104
|
end
|
|
82
105
|
unless found
|
|
106
|
+
# An opening bracket found during the scan can only start a link if a later bracket has a
|
|
107
|
+
# level of one less than the opening bracket.
|
|
108
|
+
levels = {}
|
|
109
|
+
brackets.reverse_each do |pos, level|
|
|
110
|
+
@link_scan_failures[(pos << 2) | context] = true if pos && !levels[level - 1]
|
|
111
|
+
levels[level] = true
|
|
112
|
+
end
|
|
113
|
+
@link_scan_failures[start_key] = true
|
|
83
114
|
@src.revert_pos(saved_pos)
|
|
115
|
+
@src.terminate if @tree.type == :a || @tree.type == :img
|
|
84
116
|
add_text(result)
|
|
85
117
|
return
|
|
86
118
|
end
|
|
@@ -88,7 +120,7 @@ module Kramdown
|
|
|
88
120
|
@src.scan(LINK_BRACKET_STOP_RE)
|
|
89
121
|
|
|
90
122
|
# reference style link or no link url
|
|
91
|
-
if @src.scan(LINK_INLINE_ID_RE) || !@src.
|
|
123
|
+
if @src.scan(LINK_INLINE_ID_RE) || !@src.match?(/\(/)
|
|
92
124
|
emit_warning = !@src[1]
|
|
93
125
|
link_id = normalize_link_id(@src[1] || alt_text)
|
|
94
126
|
if @link_defs.key?(link_id)
|
|
@@ -24,6 +24,8 @@ module Kramdown
|
|
|
24
24
|
content_re = /^(?:(?:\t| {4}){#{indentation / 4}} {#{indentation % 4}}|(?:\t| {4}){#{indentation / 4 + 1}}).*\S.*\n/
|
|
25
25
|
lazy_re = /(?!^ {0,#{[indentation, 3].min}}(?:#{IAL_BLOCK}|#{LAZY_END_HTML_STOP}|#{LAZY_END_HTML_START})).*\S.*\n/
|
|
26
26
|
|
|
27
|
+
h.shift if h.size > 100
|
|
28
|
+
|
|
27
29
|
h[indentation] = [content_re, lazy_re, indent_re]
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -53,7 +55,7 @@ module Kramdown
|
|
|
53
55
|
# Parse the ordered or unordered list at the current location.
|
|
54
56
|
def parse_list
|
|
55
57
|
start_line_number = @src.current_line_number
|
|
56
|
-
type, list_start_re = (@src.
|
|
58
|
+
type, list_start_re = (@src.match?(LIST_START_UL) ? [:ul, LIST_START_UL] : [:ol, LIST_START_OL])
|
|
57
59
|
list = new_block_el(type, nil, nil, location: start_line_number)
|
|
58
60
|
|
|
59
61
|
item = nil
|
|
@@ -63,7 +65,7 @@ module Kramdown
|
|
|
63
65
|
last_is_blank = false
|
|
64
66
|
until @src.eos?
|
|
65
67
|
start_line_number = @src.current_line_number
|
|
66
|
-
if last_is_blank && @src.
|
|
68
|
+
if last_is_blank && @src.match?(HR_START)
|
|
67
69
|
break
|
|
68
70
|
elsif @src.scan(EOB_MARKER)
|
|
69
71
|
eob_found = true
|
|
@@ -200,7 +202,7 @@ module Kramdown
|
|
|
200
202
|
def_start_re = fetch_pattern(:dl, indentation)
|
|
201
203
|
first_as_para = false
|
|
202
204
|
last_is_blank = false
|
|
203
|
-
elsif @src.
|
|
205
|
+
elsif @src.match?(EOB_MARKER)
|
|
204
206
|
break
|
|
205
207
|
elsif (result = @src.scan(content_re)) || (!last_is_blank && (result = @src.scan(lazy_re)))
|
|
206
208
|
result.sub!(/^(\t+)/) { " " * ($1 ? 4 * $1.length : 0) }
|
|
@@ -81,6 +81,7 @@ module Kramdown
|
|
|
81
81
|
:typographic_syms, :line_break, :escaped_chars]
|
|
82
82
|
|
|
83
83
|
@span_pattern_cache ||= Hash.new {|h, k| h[k] = {} }
|
|
84
|
+
@stack_counter = 0
|
|
84
85
|
end
|
|
85
86
|
private_class_method(:new, :allocate)
|
|
86
87
|
|
|
@@ -138,6 +139,8 @@ module Kramdown
|
|
|
138
139
|
|
|
139
140
|
# Parse all block-level elements in +text+ into the element +el+.
|
|
140
141
|
def parse_blocks(el, text = nil)
|
|
142
|
+
@stack_counter += 1
|
|
143
|
+
raise Kramdown::Error, "Elements nested too deep at block level" if @stack_counter > 100
|
|
141
144
|
@stack.push([@tree, @src, @block_ial])
|
|
142
145
|
@tree, @block_ial = el, nil
|
|
143
146
|
@src = (text.nil? ? @src : ::Kramdown::Utils::StringScanner.new(text, el.options[:location]))
|
|
@@ -145,7 +148,7 @@ module Kramdown
|
|
|
145
148
|
status = catch(:stop_block_parsing) do
|
|
146
149
|
until @src.eos?
|
|
147
150
|
@block_parsers.any? do |name|
|
|
148
|
-
if @src.
|
|
151
|
+
if @src.match?(@parsers[name].start_re)
|
|
149
152
|
send(@parsers[name].method)
|
|
150
153
|
else
|
|
151
154
|
false
|
|
@@ -158,6 +161,7 @@ module Kramdown
|
|
|
158
161
|
end
|
|
159
162
|
|
|
160
163
|
@tree, @src, @block_ial = *@stack.pop
|
|
164
|
+
@stack_counter -= 1
|
|
161
165
|
status
|
|
162
166
|
end
|
|
163
167
|
|
|
@@ -213,6 +217,8 @@ module Kramdown
|
|
|
213
217
|
#
|
|
214
218
|
# The parameter +text_type+ specifies the type which should be used for created text nodes.
|
|
215
219
|
def parse_spans(el, stop_re = nil, parsers = nil, text_type = @text_type)
|
|
220
|
+
@stack_counter += 1
|
|
221
|
+
raise Kramdown::Error, "Elements nested too deep at span level" if @stack_counter > 100
|
|
216
222
|
@stack.push([@tree, @text_type]) unless @tree.nil?
|
|
217
223
|
@tree, @text_type = el, text_type
|
|
218
224
|
|
|
@@ -226,11 +232,11 @@ module Kramdown
|
|
|
226
232
|
while !@src.eos? && !stop_re_found
|
|
227
233
|
if (result = @src.scan_until(used_re))
|
|
228
234
|
add_text(result)
|
|
229
|
-
if stop_re && @src.
|
|
235
|
+
if stop_re && @src.match?(stop_re)
|
|
230
236
|
stop_re_found = (block_given? ? yield : true)
|
|
231
237
|
end
|
|
232
238
|
processed = parsers.any? do |name|
|
|
233
|
-
if @src.
|
|
239
|
+
if @src.match?(@parsers[name].start_re)
|
|
234
240
|
send(@parsers[name].method)
|
|
235
241
|
true
|
|
236
242
|
else
|
|
@@ -245,6 +251,7 @@ module Kramdown
|
|
|
245
251
|
end
|
|
246
252
|
|
|
247
253
|
@tree, @text_type = @stack.pop
|
|
254
|
+
@stack_counter -= 1
|
|
248
255
|
|
|
249
256
|
stop_re_found
|
|
250
257
|
end
|
|
@@ -65,14 +65,13 @@ module Kramdown
|
|
|
65
65
|
# NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.
|
|
66
66
|
# However we add the one indirectly by using a one-based start_line_number.
|
|
67
67
|
def current_line_number
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@previous_line_number
|
|
68
|
+
cur_pos = pos
|
|
69
|
+
if cur_pos > @previous_pos
|
|
70
|
+
@previous_line_number += string.byteslice(@previous_pos, cur_pos - @previous_pos).
|
|
71
|
+
force_encoding(Encoding::BINARY).count("\n")
|
|
72
|
+
@previous_pos = cur_pos
|
|
73
|
+
end
|
|
74
|
+
string.getbyte(cur_pos) == 10 ? @previous_line_number + 1 : @previous_line_number
|
|
76
75
|
end
|
|
77
76
|
|
|
78
77
|
end
|
data/lib/kramdown/version.rb
CHANGED
data/man/man1/kramdown.1
CHANGED
|
@@ -136,11 +136,15 @@ The value needs to be an array of option names\.
|
|
|
136
136
|
Default: [template] Used by: HTML converter
|
|
137
137
|
.RE
|
|
138
138
|
.TP
|
|
139
|
-
\fB\-\-
|
|
139
|
+
\fB\-\-header\-links\fP \fIARG\fP
|
|
140
140
|
Adds anchor tags within headers that can be used to generate permalinks when not using a table of contents\.
|
|
141
141
|
.RS
|
|
142
142
|
.P
|
|
143
|
-
The anchor tags are empty
|
|
143
|
+
If the value is \fBfalse\fP, no header links are used; if \fBtrue\fP, the defaults are used: The anchor tags are empty and at the start of the header element\. This can be changed by using a hash as value with the following symbol keys:
|
|
144
|
+
.IP \(bu 4
|
|
145
|
+
content: Defines the content of the anchor tag, default is \[u2018]\[u2019]\&\.
|
|
146
|
+
.IP \(bu 4
|
|
147
|
+
position: Whether the anchor tag is placed at the \[u2018]start\[u2019] or the \[u2018]end\[u2019] of the header tag, default is \[u2018]start\[u2019]\&\.
|
|
144
148
|
.P
|
|
145
149
|
Default: false
|
|
146
150
|
.RE
|
data/test/test_files.rb
CHANGED
|
@@ -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}$/ }
|
|
@@ -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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1 id="header">This is a header<a href="#header">Link</a></h1>
|
|
@@ -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: 
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Inline alt text override {: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
|
+
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ some [text] and [[a link](url)
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[ [ *[* ](url) and 
|
|
@@ -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">↩</a></p>
|
|
7
|
+
</li>
|
|
8
|
+
<li id="fn:2">
|
|
9
|
+
<p>Note text 2 <a href="#fnref:2" class="reversefootnote" role="doc-backlink">↩</a></p>
|
|
10
|
+
</li>
|
|
11
|
+
</ol>
|
|
12
|
+
</div>
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kramdown
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Leitner
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-11-16 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rexml
|
|
@@ -198,6 +199,9 @@ files:
|
|
|
198
199
|
- test/testcases/block/04_header/with_auto_ids.html
|
|
199
200
|
- test/testcases/block/04_header/with_auto_ids.options
|
|
200
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
|
|
201
205
|
- test/testcases/block/04_header/with_header_links.html
|
|
202
206
|
- test/testcases/block/04_header/with_header_links.options
|
|
203
207
|
- test/testcases/block/04_header/with_header_links.text
|
|
@@ -516,6 +520,8 @@ files:
|
|
|
516
520
|
- test/testcases/span/01_link/reference.html
|
|
517
521
|
- test/testcases/span/01_link/reference.options
|
|
518
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
|
|
519
525
|
- test/testcases/span/02_emphasis/empty.html
|
|
520
526
|
- test/testcases/span/02_emphasis/empty.text
|
|
521
527
|
- test/testcases/span/02_emphasis/errors.html
|
|
@@ -554,6 +560,8 @@ files:
|
|
|
554
560
|
- test/testcases/span/04_footnote/definitions.html
|
|
555
561
|
- test/testcases/span/04_footnote/definitions.latex
|
|
556
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
|
|
557
565
|
- test/testcases/span/04_footnote/footnote_link_text.html
|
|
558
566
|
- test/testcases/span/04_footnote/footnote_link_text.options
|
|
559
567
|
- test/testcases/span/04_footnote/footnote_link_text.text
|
|
@@ -657,6 +665,7 @@ homepage: http://kramdown.gettalong.org
|
|
|
657
665
|
licenses:
|
|
658
666
|
- MIT
|
|
659
667
|
metadata: {}
|
|
668
|
+
post_install_message:
|
|
660
669
|
rdoc_options:
|
|
661
670
|
- "--main"
|
|
662
671
|
- lib/kramdown/document.rb
|
|
@@ -673,7 +682,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
673
682
|
- !ruby/object:Gem::Version
|
|
674
683
|
version: '0'
|
|
675
684
|
requirements: []
|
|
676
|
-
rubygems_version:
|
|
685
|
+
rubygems_version: 3.5.22
|
|
686
|
+
signing_key:
|
|
677
687
|
specification_version: 4
|
|
678
688
|
summary: kramdown is a fast, pure-Ruby Markdown-superset converter.
|
|
679
689
|
test_files: []
|