Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple footnotes #139

Closed
allenwu1973 opened this issue Mar 20, 2019 · 3 comments
Closed

Multiple footnotes #139

allenwu1973 opened this issue Mar 20, 2019 · 3 comments

Comments

@allenwu1973
Copy link

Hi

I found adding multiple footnote reference together, without space, does not work in cmark-gfm.
This does work in pandoc and kramdown.

Thank you

This is my test [^ref1][^ref2].

[^ref1]: some ref
[^ref2]: other ref
@allenwu1973
Copy link
Author

Here is a naive patch that seems to fix this, not sure if this the right thing to do.

diff --git a/src/inlines.c b/src/inlines.c
index 63caeeb..5d27ebf 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -1137,7 +1137,14 @@ noMatch:
       inl->as.literal = cmark_chunk_dup(literal, 1, literal->len - 1);
       inl->start_line = inl->end_line = subj->line;
       inl->start_column = opener->inl_text->start_column;
+
+      // A footnote reference cannot have labels
+      if (found_label) {
+        subj->pos = initial_pos;
+      }
+
       inl->end_column = subj->pos + subj->column_offset + subj->block_offset;

@phillmv
Copy link
Member

phillmv commented Sep 16, 2021

I independently came to this same conclusion and roughly the same patch! This just got merged in, cheers.

@waldyrious
Copy link

I independently came to this same conclusion and roughly the same patch! This just got merged in, cheers.

For additional context, see #229 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants