Simplified example:
root = Kramdown::Element.new(:root)
root.children << Kramdown::Element.new(:text, 'stuff')
Kramdown::Converter::Kramdown.convert(root)
2: from /Users/joey/.rvm/gems/ruby-2.6.3/gems/kramdown-2.1.0/lib/kramdown/converter/base.rb:109:in `convert'
1: from /Users/joey/.rvm/gems/ruby-2.6.3/gems/kramdown-2.1.0/lib/kramdown/converter/base.rb:109:in `encode!'
TypeError (no implicit conversion of nil into String)
what works:
root = Kramdown::Element.new(:root, nil, nil, encoding: Encoding::UTF_8)
Now, it makes sense that an encoding is needed. But the error it produces doesn't really point to the source of the problem at all - I had to look at kramdown's source to figure out what was actually wrong.
Simplified example:
what works:
Now, it makes sense that an encoding is needed. But the error it produces doesn't really point to the source of the problem at all - I had to look at
kramdown's source to figure out what was actually wrong.