Skip to content

Incorrect sourcepos for a html comment of HtmlBlock #507

Open
@akiomik

Description

@akiomik
  • expected: 1:1-1:21
  • actual: 1:1-0:0

source:

let text = "<!-- A html block -->";
let arena = Arena::new();
let ast = parse_document(&arena, text, &Options::default());
println!("{:?}", ast);

output:

Node {
  data: RefCell { value: Ast { value: Document, sourcepos: Sourcepos { start: LineColumn { line: 1, column: 1 }, end: LineColumn { line: 1, column: 21 } }, internal_offset: 0, content: "", open: false, last_line_blank: false, table_visited: false, line_offsets: [] } },
  children: [
    Node {
      data: RefCell { value: Ast { value: HtmlBlock(NodeHtmlBlock { block_type: 2, literal: "<!-- A html block -->\n" }), sourcepos: Sourcepos { start: LineColumn { line: 1, column: 1 }, end: LineColumn { line: 0, column: 0 } }, internal_offset: 0, content: "", open: false, last_line_blank: false, table_visited: false, line_offsets: [0] } },
      children: []
    }
  ]
}

environment:

  • rustc 1.83.0 (90b35a623 2024-11-26)
  • comrak 0.31.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions