Kramdown version 2.5.1 raises an error in HTML conversion when a Markdown document contains two footnote markers (such as [^1]:) one after the other.
The following code demonstrates this issue.
require 'kramdown'
Kramdown::Document.new(<<__END__
A[^1] B[^2]
[^1]: [^2]: Note text 2
[^3]: Note text 3
__END__
).to_html
/usr/local/share/gems/gems/kramdown-2.5.1/lib/kramdown/converter/html.rb:507:in 'Kramdown::Converter::Html#footnote_content': undefined method 'type' for nil (NoMethodError)
if li.children.last.type == :p || @options[:footnote_backlink_inline]
^^^^^
from /usr/local/share/gems/gems/kramdown-2.5.1/lib/kramdown/converter/html.rb:389:in 'Kramdown::Converter::Html#convert_root'
from /usr/local/share/gems/gems/kramdown-2.5.1/lib/kramdown/converter/html.rb:58:in 'Kramdown::Converter::Html#convert'
from /usr/local/share/gems/gems/kramdown-2.5.1/lib/kramdown/converter/base.rb:107:in 'Kramdown::Converter::Base.convert'
from /usr/local/share/gems/gems/kramdown-2.5.1/lib/kramdown/document.rb:116:in 'Kramdown::Document#method_missing'
from (irb):28:in '<main>'
from <internal:kernel>:168:in 'Kernel#loop'
from /usr/share/gems/gems/irb-1.14.3/exe/irb:9:in '<top (required)>'
from /usr/bin/irb:25:in 'Kernel#load'
from /usr/bin/irb:25:in '<main>'
By contrast, no error is raised in the following code:
require 'kramdown'
Kramdown::Document.new(<<__END__
A[^1] B[^2]
[^1]:
[^2]: Note text 2
[^3]: Note text 3
__END__
).to_html
Kramdown version 2.5.1 raises an error in HTML conversion when a Markdown document contains two footnote markers (such as
[^1]:) one after the other.The following code demonstrates this issue.
By contrast, no error is raised in the following code: