Skip to content

Exclamation point before footnote causes footnote reference event to be incorrect #923

@dsherret

Description

@dsherret
Hello, world![^footnote] This is some text.

[^footnote]: This is the footnote.

Events with ranges:

Raw event: Some((Start(Paragraph), 0..44))
Raw event: Some((Text(Borrowed("Hello, world")), 0..12))
Raw event: Some((Text(Inlined(InlineStr { inner: [33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], len: 1 })), 12..14))
Raw event: Some((FootnoteReference(Borrowed("footnote")), 23..24))
Raw event: Some((Text(Borrowed(" This is some text.")), 24..43))
Raw event: Some((End(Paragraph), 0..44))
Raw event: Some((Start(FootnoteDefinition(Borrowed("footnote"))), 45..80))
Raw event: Some((Start(Paragraph), 58..80))
Raw event: Some((Text(Borrowed("This is the footnote.")), 58..79))
Raw event: Some((End(Paragraph), 58..80))
Raw event: Some((End(FootnoteDefinition), 45..80))
Raw event: None

So the first few event ranges (minus paragraph) are:

Hello, world
![
]

If I add a space between the exclamation point and the [ (Hello, world! [^footnote]) then it's fine:

Raw event: Some((Start(Paragraph), 0..45))
Raw event: Some((Text(Borrowed("Hello, world! ")), 0..14))
Raw event: Some((FootnoteReference(Borrowed("footnote")), 14..25))
Raw event: Some((Text(Borrowed(" This is some text.")), 25..44))
Raw event: Some((End(Paragraph), 0..45))
Raw event: Some((Start(FootnoteDefinition(Borrowed("footnote"))), 46..81))
Raw event: Some((Start(Paragraph), 59..81))
Raw event: Some((Text(Borrowed("This is the footnote.")), 59..80))
Raw event: Some((End(Paragraph), 59..81))
Raw event: Some((End(FootnoteDefinition), 46..81))
Raw event: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions