From ddbeb9c9d87b6e938eac09bc0ee4f354c4a552f2 Mon Sep 17 00:00:00 2001 From: Fedor Sheremetyev Date: Mon, 10 Jul 2023 10:09:58 +0100 Subject: Fix parsing of nested links Enter event for `LabelText` should be inserted before existing events at the index in order to have correct nesting. Otherwise nested elements could have Enter event first and that would result in incorrect nesting in the tree when converting to AST. Closes GH-73. Closes GH-50. --- src/construct/label_end.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/construct/label_end.rs b/src/construct/label_end.rs index c7cca66..8898b88 100644 --- a/src/construct/label_end.rs +++ b/src/construct/label_end.rs @@ -752,7 +752,7 @@ fn inject_labels(tokenizer: &mut Tokenizer, labels: &[Label]) { // Though: if this was what looked like a footnote, but didn’t match, // it’s a link instead, and we need to inject the `^`. if label.start.1 != label.end.0 || !caret.is_empty() { - tokenizer.map.add( + tokenizer.map.add_before( label.start.1 + 1, 0, vec![Event { -- cgit