Skip to content

incorrect sourcepos for escaped character spans #562

@tvanderstad

Description

@tvanderstad

First off, shoutout to @kivikakk for the recent inline sourcepos fixes! I ran into a bug with source positions recently and just thought - oh, no - until I updated from 0.29 to 0.38 and not only was my issue resolved but I also got subscripts and alerts. Nice!

This is another one of #448, #502, #507. When using options.render.escaped_char_spans = true;, the sourcepos info for the text child node in the escaped tag node contains the backslash that escaped it. This is in contrast to, say, the text child node of an emph node, where the emph includes the syntax that made it emph but the text inside doesn't.

So, in this example doc...

\`code\`

...my program's ascii-art debug output is...

■ Document 1:1-1:8 +1■
  └>■ Paragraph 1:1-1:8 +3=
    ├>= Escaped 1:1-1:2 +1■
    │ └>= Text("`") 1:1-1:2
    ├>= Text("code") 1:3-1:6
    └>= Escaped 1:7-1:8 +1■
      └>= Text("`") 1:7-1:8

...but I expect it to be...

■ Document 1:1-1:8 +1■
  └>■ Paragraph 1:1-1:8 +3=
    ├>= Escaped 1:1-1:2 +1■
    │ └>= Text("`") 1:2-1:2
    ├>= Text("code") 1:3-1:6
    └>= Escaped 1:7-1:8 +1■
      └>= Text("`") 1:8-1:8

...with the start and end LineColumn's of each text range being equal, consistent with them having length 1, and with those text ranges being strict subsets of the text ranges for their parent 'escaped' nodes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions