Skip to content

Parsing | causes location to be off by one for all following elements #129

@mivok

Description

@mivok

If you parse the following:

`|`

(similar variations work also, such as foo | foo, but this is the simplest), then the location option shows one line too high. In addition, all subsequently parsed elements also have their locations off by one, throwing line numbers off for the rest of the document.

Simple test case:

#!/usr/bin/env ruby
require 'kramdown'
puts Kramdown::Document.new('`|`').root.children.first.options[:location]

I believe this is related to a failed attempt to parse this as a table, and then somehow messing up the parser's idea of what the current line number is. It looks like the line number is being incorrectly increased/reset at this point: https://github.com/gettalong/kramdown/blob/master/lib/kramdown/parser/kramdown/table.rb#L69 but I'm still looking to see if I can identify exactly what is happening.

Edit: this is with kramdown 1.3.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions