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

Allow multiple references to the same footnote #16

Closed
wants to merge 1 commit into from
Closed

Allow multiple references to the same footnote #16

wants to merge 1 commit into from

Conversation

smokris
Copy link

@smokris smokris commented Feb 8, 2012

Currently the following markdown doesn't parse as I'd expect:

    - refer to footnote A[^1]
    - refer to footnote B[^2]
    - refer to footnote A again[^1]

[^1]: footnote A
[^2]: footnote B

The "refer to footnote A again[^1]" line doesn't get linked to footnote A.

I've modified the footnote callback so that this is possible.

@michelf
Copy link
Owner

michelf commented Feb 8, 2012

This shouldn't work like this. There is no requirement that the footnote reference markers in the Markdown source start from one, be in the right order, or be numbers at all. So you should not rely on the footnote reference marker in $matches[1] to be the right number. That's why there was a counter there before.

Otherwise, it's a nice patch. Can you fix that?

@michelf
Copy link
Owner

michelf commented Oct 5, 2012

I implemented it slightly differently so that footnotes markers are properly numbered even if the user didn't use numbers as footnote reference in his Markdown file.

@taufik-nurrohman
Copy link

When writing multiple footnotes for the same reference, I got this weird reference ID pattern. Is this valid?

Example

Lorem ipsum [^1] dolor sit amet [^2]

Lorem ipsum [^1] dolor sit amet [^2]

[^1]: Footnote 1
[^2]: Footnote 2

Footnote Output

  1. Footnote 1
  2. Footnote 2

Hash Produced

#fnref:1
#fnref2:1
#fnref:2
#fnref2:2

Why not produce this instead?

#fnref:1
#fnref:1-2
#fnref:2
#fnref:2-2

or …

#fnref:1
#fnref-2:1
#fnref:2
#fnref-2:2

@michelf
Copy link
Owner

michelf commented Jan 10, 2016

@tovic This has little to do with this four year old pull request. Please start a new issue if you want to discuss this.

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

Successfully merging this pull request may close these issues.

3 participants