Skip to content

sourcepos is incorrect for <script> tags #448

@GabeIsman

Description

@GabeIsman

I've encountered an odd issue. I'm using the Ruby wrapper (Commonmarker) and inspecting the AST shows some strange behavior around the sourcepos of <script> tags. AFAICT this is only related to script tags, and only ones that appear all on one line at that.

Commonmarker.parse("<script></script>")
=> #<Commonmarker::Node(document):
  source_position={:start_line=>1, :start_column=>1, :end_line=>1, :end_column=>17}
  children=[#<Commonmarker::Node(html_block):
       source_position={:start_line=>1,
        :start_column=>1,
        :end_line=>0,
        :end_column=>0}>]>

note the end_line and end_column are both zero. In general I've observed that end_line is start_line - 1, and end_column is always zero.

Let me know if I should open an issue on Commonmarker instead, but I don't see how this could be caused by the wrapper. I just lack the rust expertise to test it directly in rust, sorry!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions