Closed
Description
This is a strange one:
$ cat testcase.rb
#!/usr/bin/env ruby
require 'kramdown'
text = <<EOF
nbsp nbsp (the first space on this line is unicode 0xA0 - a non-breaking space)
- Test
# Test
EOF
doc = Kramdown::Document.new(text).root
puts doc.children.inspect
$ ./testcase.rb
[<kd:p nil {:location=>1} [<kd:text "nbsp nbsp" nil>]>, <kd:blank "\n" nil>, <kd:ul nil {:location=>3} [<kd:li nil {:location=>3} [<kd:p nil {:location=>3, :transparent=>true} [<kd:text "Test" nil>]>]>]>, <kd:blank "\n" nil>, <kd:header nil {:level=>1, :raw_text=>"Test", :location=>6} [<kd:text "Test" nil>]>]
The location for the header is parsed as line 6, when it should be line 5. Interestingly, the location for the list item is shown as line 3, which is correct.
- If I delete the 0xA0 (http://www.fileformat.info/info/unicode/char/a0/index.htm) character in between the two 'nbsp' words on the first line, and replace with a regular space it works.
- If I delete the list item, it works.
This came from a much larger markdown document, and I managed to get it down to that small test case while still reproducing the issue.