Skip to content

Return start/end positions on AST nodes #88

Description

@jamiebuilds

It would be really nice if AST nodes had start/end positions for every node:

parse("Hello **World**")
[
  {
    type: "text",
    content: "Hello",
    loc: { start: 0, end: 6 },
  },
  {
    type: "strong",
    content: [
      {
        type: "text",
        content: "World",
        loc: { start: 8, end: 13 },
      }
    ],
    loc: { start: 6, end: 15 },
  },
]

Right now it's impossible to reconstruct this data from just the AST.

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