kramdown 2.3.2 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTERS +11 -2
  3. data/VERSION +1 -1
  4. data/bin/kramdown +15 -12
  5. data/lib/kramdown/converter/base.rb +2 -2
  6. data/lib/kramdown/converter/html.rb +23 -15
  7. data/lib/kramdown/converter/kramdown.rb +31 -21
  8. data/lib/kramdown/converter/latex.rb +11 -10
  9. data/lib/kramdown/converter/man.rb +3 -3
  10. data/lib/kramdown/converter/math_engine/mathjax.rb +1 -1
  11. data/lib/kramdown/converter/remove_html_tags.rb +5 -4
  12. data/lib/kramdown/document.rb +1 -1
  13. data/lib/kramdown/element.rb +1 -1
  14. data/lib/kramdown/options.rb +50 -15
  15. data/lib/kramdown/parser/base.rb +6 -0
  16. data/lib/kramdown/parser/html.rb +24 -18
  17. data/lib/kramdown/parser/kramdown/abbreviation.rb +4 -2
  18. data/lib/kramdown/parser/kramdown/codespan.rb +1 -1
  19. data/lib/kramdown/parser/kramdown/emphasis.rb +6 -1
  20. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  21. data/lib/kramdown/parser/kramdown/extensions.rb +6 -6
  22. data/lib/kramdown/parser/kramdown/html.rb +26 -23
  23. data/lib/kramdown/parser/kramdown/html_entity.rb +1 -1
  24. data/lib/kramdown/parser/kramdown/link.rb +4 -4
  25. data/lib/kramdown/parser/kramdown/list.rb +19 -18
  26. data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
  27. data/lib/kramdown/parser/kramdown.rb +5 -4
  28. data/lib/kramdown/utils/entities.rb +661 -5
  29. data/lib/kramdown/utils/html.rb +1 -1
  30. data/lib/kramdown/utils/unidecoder.rb +9 -13
  31. data/lib/kramdown/version.rb +1 -1
  32. data/man/man1/kramdown.1 +25 -0
  33. data/test/test_files.rb +11 -0
  34. data/test/testcases/block/03_paragraph/to_kramdown.kramdown +7 -0
  35. data/test/testcases/block/03_paragraph/to_kramdown.text +5 -0
  36. data/test/testcases/block/04_header/with_header_links.html +7 -0
  37. data/test/testcases/block/04_header/with_header_links.options +2 -0
  38. data/test/testcases/block/04_header/with_header_links.text +8 -0
  39. data/test/testcases/block/04_header/with_line_break.html +1 -0
  40. data/test/testcases/block/04_header/with_line_break.text +1 -0
  41. data/test/testcases/block/08_list/escaping.html +4 -0
  42. data/test/testcases/block/08_list/escaping.text +4 -0
  43. data/test/testcases/block/08_list/nested_compact.kramdown +7 -0
  44. data/test/testcases/block/08_list/nested_compact.text +6 -0
  45. data/test/testcases/block/08_list/special_cases.html +10 -0
  46. data/test/testcases/block/08_list/special_cases.text +9 -0
  47. data/test/testcases/block/09_html/cdata_section.html +10 -0
  48. data/test/testcases/block/09_html/cdata_section.text +10 -0
  49. data/test/testcases/block/09_html/html_to_native/table_simple.html +3 -0
  50. data/test/testcases/block/09_html/html_to_native/table_simple.text +3 -0
  51. data/test/testcases/block/12_extension/options.html +2 -2
  52. data/test/testcases/block/12_extension/options2.html +2 -2
  53. data/test/testcases/block/14_table/table_with_footnote.html +2 -2
  54. data/test/testcases/block/16_toc/toc_with_footnotes.html +2 -2
  55. data/test/testcases/span/02_emphasis/normal.html +6 -1
  56. data/test/testcases/span/02_emphasis/normal.text +5 -0
  57. data/test/testcases/span/04_footnote/backlink_inline.html +10 -10
  58. data/test/testcases/span/04_footnote/backlink_text.html +2 -2
  59. data/test/testcases/span/04_footnote/footnote_link_text.html +12 -0
  60. data/test/testcases/span/04_footnote/footnote_link_text.options +1 -0
  61. data/test/testcases/span/04_footnote/footnote_link_text.text +4 -0
  62. data/test/testcases/span/04_footnote/footnote_nr.html +3 -3
  63. data/test/testcases/span/04_footnote/footnote_prefix.html +3 -3
  64. data/test/testcases/span/04_footnote/inside_footnote.html +6 -6
  65. data/test/testcases/span/04_footnote/markers.html +10 -10
  66. data/test/testcases/span/04_footnote/placement.html +2 -2
  67. data/test/testcases/span/04_footnote/regexp_problem.html +2 -2
  68. data/test/testcases/span/04_footnote/without_backlink.html +2 -2
  69. data/test/testcases/span/abbreviations/abbrev.html +4 -0
  70. data/test/testcases/span/abbreviations/abbrev.text +7 -0
  71. data/test/testcases/span/abbreviations/in_footnote.html +2 -2
  72. metadata +23 -9
@@ -20,12 +20,7 @@ module Kramdown
20
20
  File.directory?(File.join(File.expand_path(dir), "stringex", "unidecoder_data"))
21
21
  end
22
22
 
23
- if !path
24
- def self.decode(string)
25
- string
26
- end
27
- else
28
-
23
+ if path
29
24
  CODEPOINTS = Hash.new do |h, k|
30
25
  h[k] = YAML.load_file(File.join(path, "stringex", "unidecoder_data", "#{k}.yml"))
31
26
  end
@@ -33,15 +28,16 @@ module Kramdown
33
28
  # Transliterate string from Unicode into ASCII.
34
29
  def self.decode(string)
35
30
  string.gsub(/[^\x00-\x7f]/u) do |codepoint|
36
- begin
37
- unpacked = codepoint.unpack("U")[0]
38
- CODEPOINTS[sprintf("x%02x", unpacked >> 8)][unpacked & 255]
39
- rescue StandardError
40
- "?"
41
- end
31
+ unpacked = codepoint.unpack1("U")
32
+ CODEPOINTS[sprintf("x%02x", unpacked >> 8)][unpacked & 255]
33
+ rescue StandardError
34
+ "?"
42
35
  end
43
36
  end
44
-
37
+ else
38
+ def self.decode(string)
39
+ string
40
+ end
45
41
  end
46
42
 
47
43
  end
@@ -10,6 +10,6 @@
10
10
  module Kramdown
11
11
 
12
12
  # The kramdown version.
13
- VERSION = '2.3.2'
13
+ VERSION = '2.5.0'
14
14
 
15
15
  end
data/man/man1/kramdown.1 CHANGED
@@ -100,6 +100,15 @@ Setting this option to true tries to place the footnote backlink in the last, po
100
100
  Default: false Used by: HTML converter
101
101
  .RE
102
102
  .TP
103
+ \fB\-\-footnote\-link\-text\fP \fIARG\fP
104
+ The text used for the footnote number in a footnote link
105
+ .RS
106
+ .P
107
+ This option can be used to add additional text to the footnote link\. It should be a format string, and is passed the footnote number as the only argument to the format string\. e\.g\. \[u201c][footnote %s]\[u201d] would display as \[u201c][footnote 1]\[u201d]\&\.
108
+ .P
109
+ Default: \[u2018]%s\[u2019] Used by: HTML
110
+ .RE
111
+ .TP
103
112
  \fB\-\-footnote\-nr\fP \fIARG\fP
104
113
  The number of the first footnote
105
114
  .RS
@@ -127,6 +136,15 @@ The value needs to be an array of option names\.
127
136
  Default: [template] Used by: HTML converter
128
137
  .RE
129
138
  .TP
139
+ \fB\-\-[no\-]header\-links\fP
140
+ Adds anchor tags within headers that can be used to generate permalinks when not using a table of contents\.
141
+ .RS
142
+ .P
143
+ The anchor tags are empty, but can be styled to your liking\.
144
+ .P
145
+ Default: false
146
+ .RE
147
+ .TP
130
148
  \fB\-\-header\-offset\fP \fIARG\fP
131
149
  Sets the output offset for headers
132
150
  .RS
@@ -174,6 +192,13 @@ If the value is a String, it has to contain a valid YAML hash and the hash has t
174
192
  Default: {} Used by: kramdown parser
175
193
  .RE
176
194
  .TP
195
+ \fB\-\-list\-indent\fP \fIARG\fP
196
+ Sets the number of spaces to use for list indentation
197
+ .RS
198
+ .P
199
+ Default: 2 Used by: Kramdown converter
200
+ .RE
201
+ .TP
177
202
  \fB\-\-math\-engine\fP \fIARG\fP
178
203
  Set the math engine
179
204
  .RS
data/test/test_files.rb CHANGED
@@ -86,6 +86,7 @@ class TestFiles < Minitest::Test
86
86
  'test/testcases/span/05_html/mark_element.html', # bc of tidy
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
+ 'test/testcases/block/04_header/with_header_links.html', # because of header_links option
89
90
  ].compact
90
91
  EXCLUDE_HTML_TEXT_FILES = [
91
92
  'test/testcases/block/09_html/parse_as_span.htmlinput',
@@ -138,6 +139,7 @@ class TestFiles < Minitest::Test
138
139
  'test/testcases/block/06_codeblock/with_lang_in_fenced_block_any_char.text',
139
140
  'test/testcases/block/03_paragraph/standalone_image.text', # bc of standalone image
140
141
  'test/testcases/cjk-line-break.text', # latex unicode support
142
+ 'test/testcases/block/04_header/with_auto_ids.text', # bc of Unicode characters
141
143
  ].compact
142
144
  Dir[File.dirname(__FILE__) + '/testcases/**/*.text'].each do |text_file|
143
145
  next if EXCLUDE_LATEX_FILES.any? {|f| text_file =~ /#{f}$/ }
@@ -197,6 +199,9 @@ class TestFiles < Minitest::Test
197
199
  kdtext = Kramdown::Document.new(File.read(text_file), options).to_kramdown
198
200
  html = Kramdown::Document.new(kdtext, options).to_html
199
201
  assert_equal(tidy_output(File.read(html_file)), tidy_output(html))
202
+ kdtext4 = Kramdown::Document.new(File.read(text_file), options.merge({list_indent: 4})).to_kramdown
203
+ html = Kramdown::Document.new(kdtext4, options).to_html
204
+ assert_equal(tidy_output(File.read(html_file)), tidy_output(html))
200
205
  end
201
206
  end
202
207
  end
@@ -237,6 +242,7 @@ class TestFiles < Minitest::Test
237
242
  'test/testcases/span/04_footnote/backlink_inline.html', # bc of mathjax
238
243
  'test/testcases/block/09_html/standalone_image_in_div.html', # bc of standalone image
239
244
  'test/testcases/block/09_html/processing_instruction.html', # bc of PI
245
+ 'test/testcases/block/04_header/with_header_links.html', # bc of header_links option
240
246
  ].compact
241
247
  Dir[File.dirname(__FILE__) + '/testcases/**/*.html'].each do |html_file|
242
248
  next if EXCLUDE_HTML_KD_FILES.any? {|f| html_file =~ /#{f}$/ }
@@ -263,6 +269,7 @@ class TestFiles < Minitest::Test
263
269
 
264
270
  EXCLUDE_MODIFY = [
265
271
  'test/testcases/block/06_codeblock/rouge/multiple.text', # bc of HTMLFormater in options
272
+ 'test/testcases/block/04_header/with_header_links.text', # bc of header_links option
266
273
  ].compact
267
274
 
268
275
  # Generate test methods for asserting that converters don't modify the document tree.
@@ -275,7 +282,11 @@ class TestFiles < Minitest::Test
275
282
  define_method("test_whether_#{conv_class}_modifies_tree_with_file_#{text_file.tr('.', '_')}") do
276
283
  doc = Kramdown::Document.new(File.read(text_file), options)
277
284
  options_before = Marshal.load(Marshal.dump(doc.options))
285
+ abbrev_proc = doc.root.options[:abbrev_defs].default_proc
286
+ doc.root.options[:abbrev_defs].default_proc = doc.root.options[:abbrev_attr].default_proc = nil
278
287
  tree_before = Marshal.load(Marshal.dump(doc.root))
288
+ doc.root.options[:abbrev_defs].default_proc = doc.root.options[:abbrev_attr].default_proc =
289
+ abbrev_proc
279
290
  Kramdown::Converter.const_get(conv_class).convert(doc.root, doc.options)
280
291
  assert_equal(options_before, doc.options)
281
292
  assert_tree_not_changed(tree_before, doc.root)
@@ -0,0 +1,7 @@
1
+ aa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa
2
+ \: No definiion list
3
+
4
+ a:
5
+
6
+ *a*:
7
+
@@ -0,0 +1,5 @@
1
+ aa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa : No definiion list
2
+
3
+ a:
4
+
5
+ *a*:
@@ -0,0 +1,7 @@
1
+ <h1 id="header"><a href="#header"></a>This is a header</h1>
2
+
3
+ <h2>12. Another one-1-here</h2>
4
+
5
+ <h3>Do ^&amp; it now</h3>
6
+
7
+ <h1>Header without ID</h1>
@@ -0,0 +1,2 @@
1
+ :header_links: true
2
+ :auto_ids: false
@@ -0,0 +1,8 @@
1
+ # This is a header {#header}
2
+
3
+ ## 12. Another one-1-here
4
+
5
+ ### Do ^& it now
6
+
7
+ # Header without ID
8
+ {: id=""}
@@ -0,0 +1 @@
1
+ <h1>foo<br />bar</h1>
@@ -0,0 +1 @@
1
+ # foo<br />bar
@@ -14,4 +14,8 @@
14
14
 
15
15
  <p>1984. Was great!</p>
16
16
 
17
+ <p>1984.5 is not a book.</p>
18
+
19
+ <p>1984.</p>
20
+
17
21
  <p>- This too!</p>
@@ -14,4 +14,8 @@ I have read the book 1984.
14
14
 
15
15
  1984\. Was great!
16
16
 
17
+ 1984.5 is not a book.
18
+
19
+ 1984\.
20
+
17
21
  \- This too!
@@ -0,0 +1,7 @@
1
+ * First item
2
+ * Sub item 1
3
+ * Sub sub item
4
+ * Sub item 2
5
+ * Second item
6
+ * Sub item
7
+
@@ -0,0 +1,6 @@
1
+ * First item
2
+ * Sub item 1
3
+ * Sub sub item
4
+ * Sub item 2
5
+ * Second item
6
+ * Sub item
@@ -60,3 +60,13 @@ here</p>
60
60
  <li></li>
61
61
  <li>a</li>
62
62
  </ul>
63
+
64
+ <ul>
65
+ <li></li>
66
+ <li>
67
+ <p>one</p>
68
+ </li>
69
+ <li>
70
+ <p>two</p>
71
+ </li>
72
+ </ul>
@@ -38,3 +38,12 @@ List item without content:
38
38
 
39
39
  *
40
40
  * a
41
+ ^
42
+
43
+ *
44
+
45
+ * one
46
+
47
+ * two
48
+
49
+ ^
@@ -0,0 +1,10 @@
1
+ <figure>
2
+ +-----------------------+
3
+ | Use XML, be Happy :-) |
4
+ |_______________________|
5
+
6
+ </figure>
7
+
8
+ <p>Inline section &lt;goes&gt; here.</p>
9
+
10
+ <p>Inline <kbd>test *case* *section* &lt;goes&gt; here</kbd> end.</p>
@@ -0,0 +1,10 @@
1
+ <figure><![CDATA[
2
+ +-----------------------+
3
+ | Use XML, be Happy :-) |
4
+ |_______________________|
5
+ ]]>
6
+ </figure>
7
+
8
+ Inline <![CDATA[section <goes>]]> here.
9
+
10
+ Inline <kbd>test *case* <![CDATA[*section* <goes>]]> here</kbd> end.
@@ -59,3 +59,6 @@ Some more
59
59
  </td>
60
60
  </tr>
61
61
  </table>
62
+
63
+ <table>
64
+ </table>
@@ -69,3 +69,6 @@ Some more
69
69
  </td>
70
70
  </tr>
71
71
  </table>
72
+
73
+ <table>
74
+ </table>
@@ -10,11 +10,11 @@ some <span>*para*</span>
10
10
  <p>some <span><em>para</em></span></p>
11
11
  </div>
12
12
 
13
- <p>Some text<sup id="fnref:ab" role="doc-noteref"><a href="#fn:ab" class="footnote" rel="footnote">10</a></sup>.</p>
13
+ <p>Some text<sup id="fnref:ab"><a href="#fn:ab" class="footnote" rel="footnote" role="doc-noteref">10</a></sup>.</p>
14
14
 
15
15
  <div class="footnotes" role="doc-endnotes">
16
16
  <ol start="10">
17
- <li id="fn:ab" role="doc-endnote">
17
+ <li id="fn:ab">
18
18
  <p>Some text. <a href="#fnref:ab" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
19
19
  </li>
20
20
  </ol>
@@ -1,9 +1,9 @@
1
1
 
2
- <p>Some text<sup id="fnref:ab" role="doc-noteref"><a href="#fn:ab" class="footnote" rel="footnote">1</a></sup>.</p>
2
+ <p>Some text<sup id="fnref:ab"><a href="#fn:ab" class="footnote" rel="footnote" role="doc-noteref">1</a></sup>.</p>
3
3
 
4
4
  <div class="footnotes" role="doc-endnotes">
5
5
  <ol>
6
- <li id="fn:ab" role="doc-endnote">
6
+ <li id="fn:ab">
7
7
  <p>Some text. <a href="#fnref:ab" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
8
8
  </li>
9
9
  </ol>
@@ -1,7 +1,7 @@
1
1
  <table>
2
2
  <tbody>
3
3
  <tr>
4
- <td>this is <sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup></td>
4
+ <td>this is <sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup></td>
5
5
  <td>a table</td>
6
6
  </tr>
7
7
  <tr>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <div class="footnotes" role="doc-endnotes">
15
15
  <ol>
16
- <li id="fn:1" role="doc-endnote">
16
+ <li id="fn:1">
17
17
  <p>Something</p>
18
18
 
19
19
  <blockquote>
@@ -2,11 +2,11 @@
2
2
  <li><a href="#header1-level-1" id="markdown-toc-header1-level-1">Header level 1</a></li>
3
3
  </ul>
4
4
 
5
- <h1 id="header1-level-1">Header<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> level 1</h1>
5
+ <h1 id="header1-level-1">Header<sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> level 1</h1>
6
6
 
7
7
  <div class="footnotes" role="doc-endnotes">
8
8
  <ol>
9
- <li id="fn:1" role="doc-endnote">
9
+ <li id="fn:1">
10
10
  <p>Some footnote content here <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
11
11
  </li>
12
12
  </ol>
@@ -45,7 +45,12 @@ Or this *<em>this</em>* way
45
45
  Or that <em>*that</em>* way
46
46
  Or that *<em>that*</em> way</p>
47
47
 
48
- <p><a href="http://blah.com/blah_%28">http://blah.com/blah_%28</a></p>
48
+ <p><a href="http://blah.com/blah_%28">http://blah.com/blah_%28</a>
49
+ <a href="http://blah.com/blah__%28">http://blah.com/blah__%28</a>
50
+ <a href="http://blah.com/blah___%28">http://blah.com/blah___%28</a>
51
+ <a href="http://blah.com/blah____%28">http://blah.com/blah____%28</a>
52
+ <a href="http://blah.com/blah_____%28">http://blah.com/blah_____%28</a>
53
+ <a href="http://blah.com/blah______%28">http://blah.com/blah______%28</a></p>
49
54
 
50
55
  <p><a href="A_-B">A-_B</a></p>
51
56
 
@@ -46,6 +46,11 @@ Or that *\*that*\* way
46
46
  Or that \**that\** way
47
47
 
48
48
  [http://blah.com/blah_%28](http://blah.com/blah_%28)
49
+ [http://blah.com/blah__%28](http://blah.com/blah__%28)
50
+ [http://blah.com/blah___%28](http://blah.com/blah___%28)
51
+ [http://blah.com/blah____%28](http://blah.com/blah____%28)
52
+ [http://blah.com/blah_____%28](http://blah.com/blah_____%28)
53
+ [http://blah.com/blah______%28](http://blah.com/blah______%28)
49
54
 
50
55
  [A-_B](A_-B)
51
56
 
@@ -1,16 +1,16 @@
1
- <p>This is <sup id="fnref:paragraph" role="doc-noteref"><a href="#fn:paragraph" class="footnote" rel="footnote">1</a></sup><sup id="fnref:header" role="doc-noteref"><a href="#fn:header" class="footnote" rel="footnote">2</a></sup><sup id="fnref:blockquote" role="doc-noteref"><a href="#fn:blockquote" class="footnote" rel="footnote">3</a></sup><sup id="fnref:codeblock" role="doc-noteref"><a href="#fn:codeblock" class="footnote" rel="footnote">4</a></sup><sup id="fnref:list" role="doc-noteref"><a href="#fn:list" class="footnote" rel="footnote">5</a></sup><sup id="fnref:table" role="doc-noteref"><a href="#fn:table" class="footnote" rel="footnote">6</a></sup><sup id="fnref:hrule" role="doc-noteref"><a href="#fn:hrule" class="footnote" rel="footnote">7</a></sup><sup id="fnref:mathblock" role="doc-noteref"><a href="#fn:mathblock" class="footnote" rel="footnote">8</a></sup><sup id="fnref:html" role="doc-noteref"><a href="#fn:html" class="footnote" rel="footnote">9</a></sup></p>
1
+ <p>This is <sup id="fnref:paragraph"><a href="#fn:paragraph" class="footnote" rel="footnote" role="doc-noteref">1</a></sup><sup id="fnref:header"><a href="#fn:header" class="footnote" rel="footnote" role="doc-noteref">2</a></sup><sup id="fnref:blockquote"><a href="#fn:blockquote" class="footnote" rel="footnote" role="doc-noteref">3</a></sup><sup id="fnref:codeblock"><a href="#fn:codeblock" class="footnote" rel="footnote" role="doc-noteref">4</a></sup><sup id="fnref:list"><a href="#fn:list" class="footnote" rel="footnote" role="doc-noteref">5</a></sup><sup id="fnref:table"><a href="#fn:table" class="footnote" rel="footnote" role="doc-noteref">6</a></sup><sup id="fnref:hrule"><a href="#fn:hrule" class="footnote" rel="footnote" role="doc-noteref">7</a></sup><sup id="fnref:mathblock"><a href="#fn:mathblock" class="footnote" rel="footnote" role="doc-noteref">8</a></sup><sup id="fnref:html"><a href="#fn:html" class="footnote" rel="footnote" role="doc-noteref">9</a></sup></p>
2
2
 
3
3
  <div class="footnotes" role="doc-endnotes">
4
4
  <ol>
5
- <li id="fn:paragraph" role="doc-endnote">
5
+ <li id="fn:paragraph">
6
6
 
7
7
  <p>A paragraph <a href="#fnref:paragraph" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
8
8
  </li>
9
- <li id="fn:header" role="doc-endnote">
9
+ <li id="fn:header">
10
10
 
11
11
  <h1 id="a-header">A header <a href="#fnref:header" class="reversefootnote" role="doc-backlink">&#8617;</a></h1>
12
12
  </li>
13
- <li id="fn:blockquote" role="doc-endnote">
13
+ <li id="fn:blockquote">
14
14
 
15
15
  <blockquote>
16
16
  <p>blockquote</p>
@@ -18,13 +18,13 @@
18
18
  <p>paragraph <a href="#fnref:blockquote" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
19
19
  </blockquote>
20
20
  </li>
21
- <li id="fn:codeblock" role="doc-endnote">
21
+ <li id="fn:codeblock">
22
22
 
23
23
  <pre><code>codeblock
24
24
  </code></pre>
25
25
  <p><a href="#fnref:codeblock" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
26
26
  </li>
27
- <li id="fn:list" role="doc-endnote">
27
+ <li id="fn:list">
28
28
 
29
29
  <ul>
30
30
  <li>item 1</li>
@@ -43,7 +43,7 @@
43
43
  </li>
44
44
  </ul>
45
45
  </li>
46
- <li id="fn:table" role="doc-endnote">
46
+ <li id="fn:table">
47
47
 
48
48
  <table>
49
49
  <tbody>
@@ -59,17 +59,17 @@
59
59
  </table>
60
60
  <p><a href="#fnref:table" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
61
61
  </li>
62
- <li id="fn:hrule" role="doc-endnote">
62
+ <li id="fn:hrule">
63
63
 
64
64
  <hr />
65
65
  <p><a href="#fnref:hrule" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
66
66
  </li>
67
- <li id="fn:mathblock" role="doc-endnote">
67
+ <li id="fn:mathblock">
68
68
 
69
69
  \[x + 2\]
70
70
  <p><a href="#fnref:mathblock" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
71
71
  </li>
72
- <li id="fn:html" role="doc-endnote">
72
+ <li id="fn:html">
73
73
 
74
74
  <div>test
75
75
  </div>
@@ -1,8 +1,8 @@
1
- <p>Some footnote here<sup id="fnref:fn" role="doc-noteref"><a href="#fn:fn" class="footnote" rel="footnote">1</a></sup></p>
1
+ <p>Some footnote here<sup id="fnref:fn"><a href="#fn:fn" class="footnote" rel="footnote" role="doc-noteref">1</a></sup></p>
2
2
 
3
3
  <div class="footnotes" role="doc-endnotes">
4
4
  <ol>
5
- <li id="fn:fn" role="doc-endnote">
5
+ <li id="fn:fn">
6
6
  <p>Some text here <a href="#fnref:fn" class="reversefootnote" role="doc-backlink">text &8617; &lt;img /&gt;</a></p>
7
7
  </li>
8
8
  </ol>
@@ -0,0 +1,12 @@
1
+ <p>This is a<sup id="fnref:ab"><a href="#fn:ab" class="footnote" rel="footnote" role="doc-noteref">[footnote 1]</a></sup> footnote<sup id="fnref:ab:1"><a href="#fn:ab" class="footnote" rel="footnote" role="doc-noteref">[footnote 1]</a></sup>. And another<sup id="fnref:bc"><a href="#fn:bc" class="footnote" rel="footnote" role="doc-noteref">[footnote 2]</a></sup>.</p>
2
+
3
+ <div class="footnotes" role="doc-endnotes">
4
+ <ol>
5
+ <li id="fn:ab">
6
+ <p>Some text. <a href="#fnref:ab" class="reversefootnote" role="doc-backlink">&#8617;</a> <a href="#fnref:ab:1" class="reversefootnote" role="doc-backlink">&#8617;<sup>2</sup></a></p>
7
+ </li>
8
+ <li id="fn:bc">
9
+ <p>Some other text. <a href="#fnref:bc" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
10
+ </li>
11
+ </ol>
12
+ </div>
@@ -0,0 +1 @@
1
+ :footnote_link_text: "[footnote %s]"
@@ -0,0 +1,4 @@
1
+ This is a[^ab] footnote[^ab]. And another[^bc].
2
+
3
+ [^ab]: Some text.
4
+ [^bc]: Some other text.
@@ -1,11 +1,11 @@
1
- <p>This is a footnote<sup id="fnref:ab" role="doc-noteref"><a href="#fn:ab" class="footnote" rel="footnote">35</a></sup>. And another<sup id="fnref:bc" role="doc-noteref"><a href="#fn:bc" class="footnote" rel="footnote">36</a></sup>.</p>
1
+ <p>This is a footnote<sup id="fnref:ab"><a href="#fn:ab" class="footnote" rel="footnote" role="doc-noteref">35</a></sup>. And another<sup id="fnref:bc"><a href="#fn:bc" class="footnote" rel="footnote" role="doc-noteref">36</a></sup>.</p>
2
2
 
3
3
  <div class="footnotes" role="doc-endnotes">
4
4
  <ol start="35">
5
- <li id="fn:ab" role="doc-endnote">
5
+ <li id="fn:ab">
6
6
  <p>Some text. <a href="#fnref:ab" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
7
7
  </li>
8
- <li id="fn:bc" role="doc-endnote">
8
+ <li id="fn:bc">
9
9
  <p>Some other text. <a href="#fnref:bc" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
10
10
  </li>
11
11
  </ol>
@@ -1,11 +1,11 @@
1
- <p>This is a<sup id="fnref:adf123-ab" role="doc-noteref"><a href="#fn:adf123-ab" class="footnote" rel="footnote">1</a></sup> footnote<sup id="fnref:adf123-ab:1" role="doc-noteref"><a href="#fn:adf123-ab" class="footnote" rel="footnote">1</a></sup>. And another<sup id="fnref:adf123-bc" role="doc-noteref"><a href="#fn:adf123-bc" class="footnote" rel="footnote">2</a></sup>.</p>
1
+ <p>This is a<sup id="fnref:adf123-ab"><a href="#fn:adf123-ab" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> footnote<sup id="fnref:adf123-ab:1"><a href="#fn:adf123-ab" class="footnote" rel="footnote" role="doc-noteref">1</a></sup>. And another<sup id="fnref:adf123-bc"><a href="#fn:adf123-bc" class="footnote" rel="footnote" role="doc-noteref">2</a></sup>.</p>
2
2
 
3
3
  <div class="footnotes" role="doc-endnotes">
4
4
  <ol>
5
- <li id="fn:adf123-ab" role="doc-endnote">
5
+ <li id="fn:adf123-ab">
6
6
  <p>Some text. <a href="#fnref:adf123-ab" class="reversefootnote" role="doc-backlink">&#8617;</a> <a href="#fnref:adf123-ab:1" class="reversefootnote" role="doc-backlink">&#8617;<sup>2</sup></a></p>
7
7
  </li>
8
- <li id="fn:adf123-bc" role="doc-endnote">
8
+ <li id="fn:adf123-bc">
9
9
  <p>Some other text. <a href="#fnref:adf123-bc" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
10
10
  </li>
11
11
  </ol>
@@ -1,16 +1,16 @@
1
- <p>Lorem ipsum<sup id="fnref:first" role="doc-noteref"><a href="#fn:first" class="footnote" rel="footnote">1</a></sup> dolor sit amet.</p>
1
+ <p>Lorem ipsum<sup id="fnref:first"><a href="#fn:first" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> dolor sit amet.</p>
2
2
 
3
- <p>Lorem ipsum<sup id="fnref:second" role="doc-noteref"><a href="#fn:second" class="footnote" rel="footnote">2</a></sup> dolor sit amet.</p>
3
+ <p>Lorem ipsum<sup id="fnref:second"><a href="#fn:second" class="footnote" rel="footnote" role="doc-noteref">2</a></sup> dolor sit amet.</p>
4
4
 
5
5
  <div class="footnotes" role="doc-endnotes">
6
6
  <ol>
7
- <li id="fn:first" role="doc-endnote">
8
- <p>Consecutur adisping.<sup id="fnref:third" role="doc-noteref"><a href="#fn:third" class="footnote" rel="footnote">3</a></sup> <a href="#fnref:first" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
7
+ <li id="fn:first">
8
+ <p>Consecutur adisping.<sup id="fnref:third"><a href="#fn:third" class="footnote" rel="footnote" role="doc-noteref">3</a></sup> <a href="#fnref:first" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
9
9
  </li>
10
- <li id="fn:second" role="doc-endnote">
10
+ <li id="fn:second">
11
11
  <p>Sed ut perspiciatis unde omnis. <a href="#fnref:second" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
12
12
  </li>
13
- <li id="fn:third" role="doc-endnote">
13
+ <li id="fn:third">
14
14
  <p>Sed ut. <a href="#fnref:third" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
15
15
  </li>
16
16
  </ol>
@@ -1,25 +1,25 @@
1
- <p>This is some *ref.<sup id="fnref:fn" role="doc-noteref"><a href="#fn:fn" class="footnote" rel="footnote">1</a></sup></p>
1
+ <p>This is some *ref.<sup id="fnref:fn"><a href="#fn:fn" class="footnote" rel="footnote" role="doc-noteref">1</a></sup></p>
2
2
 
3
3
  <blockquote>
4
- <p>a blockquote <sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">2</a></sup></p>
4
+ <p>a blockquote <sup id="fnref:3"><a href="#fn:3" class="footnote" rel="footnote" role="doc-noteref">2</a></sup></p>
5
5
  </blockquote>
6
6
 
7
7
  <ul>
8
- <li>and a list item <sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">3</a></sup></li>
8
+ <li>and a list item <sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">3</a></sup></li>
9
9
  </ul>
10
10
 
11
- <h1>And a header<sup id="fnref:now" role="doc-noteref"><a href="#fn:now" class="footnote" rel="footnote">4</a></sup></h1>
11
+ <h1>And a header<sup id="fnref:now"><a href="#fn:now" class="footnote" rel="footnote" role="doc-noteref">4</a></sup></h1>
12
12
 
13
13
  <p>A marker without a definition [^without].</p>
14
14
 
15
- <p>A marker <sup id="fnref:empty" role="doc-noteref"><a href="#fn:empty" class="footnote" rel="footnote">5</a></sup> used twice<sup id="fnref:fn:1" role="doc-noteref"><a href="#fn:fn" class="footnote" rel="footnote">1</a></sup> and thrice<sup id="fnref:fn:2" role="doc-noteref"><a href="#fn:fn" class="footnote" rel="footnote">1</a></sup>.</p>
15
+ <p>A marker <sup id="fnref:empty"><a href="#fn:empty" class="footnote" rel="footnote" role="doc-noteref">5</a></sup> used twice<sup id="fnref:fn:1"><a href="#fn:fn" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> and thrice<sup id="fnref:fn:2"><a href="#fn:fn" class="footnote" rel="footnote" role="doc-noteref">1</a></sup>.</p>
16
16
 
17
17
  <div class="footnotes" role="doc-endnotes">
18
18
  <ol>
19
- <li id="fn:fn" role="doc-endnote">
19
+ <li id="fn:fn">
20
20
  <p>Some foot note text&nbsp;<a href="#fnref:fn" class="reversefootnote" role="doc-backlink">&#8617;</a>&nbsp;<a href="#fnref:fn:1" class="reversefootnote" role="doc-backlink">&#8617;<sup>2</sup></a>&nbsp;<a href="#fnref:fn:2" class="reversefootnote" role="doc-backlink">&#8617;<sup>3</sup></a></p>
21
21
  </li>
22
- <li id="fn:3" role="doc-endnote">
22
+ <li id="fn:3">
23
23
  <p>other text
24
24
  with more lines</p>
25
25
 
@@ -28,17 +28,17 @@ with more lines</p>
28
28
  </blockquote>
29
29
  <p><a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
30
30
  </li>
31
- <li id="fn:1" role="doc-endnote">
31
+ <li id="fn:1">
32
32
  <p>some <em>text</em>&nbsp;<a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
33
33
  </li>
34
- <li id="fn:now" role="doc-endnote">
34
+ <li id="fn:now">
35
35
 
36
36
  <pre><code>code block
37
37
  continued here
38
38
  </code></pre>
39
39
  <p><a href="#fnref:now" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
40
40
  </li>
41
- <li id="fn:empty" role="doc-endnote">
41
+ <li id="fn:empty">
42
42
 
43
43
  <p><a href="#fnref:empty" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
44
44
  </li>
@@ -1,11 +1,11 @@
1
1
  <div class="footnotes" role="doc-endnotes">
2
2
  <ol>
3
- <li id="fn:1" role="doc-endnote">
3
+ <li id="fn:1">
4
4
  <p>Footnote \` text&#160;<a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
5
5
  </li>
6
6
  </ol>
7
7
  </div>
8
8
 
9
- <p>Some para with a<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> footnote.</p>
9
+ <p>Some para with a<sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup> footnote.</p>
10
10
 
11
11
  <p>And another para.</p>