Skip to content

Wrong source positions for Tables with empty TableHead/TableBody #216

@fjalowski

Description

@fjalowski

For TableBlocks containing either an empty TableHead or an empty TableBody (or both) the start position of the TableBlock is always set to 0, even if there are other things before the table. The start and end position of the empty head/body are both 0 in that case.

For example, this markdown:

foo

---|---

turns into this AST:

Document[0, 12]
  Paragraph[0, 4] isTrailingBlankLine
    Text[0, 3] chars:[0, 3, "foo"]
  TableBlock[0, 12]
    TableHead[0, 0]
    TableSeparator[5, 12]
      TableRow[5, 12]
        TableCell[5, 9] text:[5, 8, "---"] textClose:[8, 9, "|"]
          Text[5, 8] chars:[5, 8, "---"]
        TableCell[9, 12] text:[9, 12, "---"]
          Text[9, 12] chars:[9, 12, "---"]
    TableBody[0, 0]

I would expect the start of the TableBlock to be 5, the start and end of the TableHead to be 5 and the start and end of the TableBody to be 12.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions