-
Notifications
You must be signed in to change notification settings - Fork 60
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
For footnotes linked via an id, use id when generating the hash #50
Comments
Can you show a markdown example where that link changes? |
I think I may not have explained this clearly enough. I was referring to the link changing as the content is edited (e.g. adding a paragraph with a footnote above another paragraph with a footnote). This is not something that can be "shown" as an example. |
Just want to add a belated +1 to this issue, as I just noticed that my footnote ids were getting rewritten by the plugin. If it’d be possible to preserve the ids as written, that’d be remarkable. |
Plus one for that! :-) I have two different markdown sections on a single web page, and the problem at the moment is that footnotes in both sections have the same id's (e.g. #fn1), and so when the user clicks on the link in the second (lower down) section, it jumps the browser back up to the first. Ideally I need to be able to set the id's manually, or provide a prefix for each markdown section, so that they use different anchors. Other than this the plugin is AWESOME, thank you! |
See this: markdown-it-footnote/index.mjs Lines 8 to 15 in fe6c169
You can customize anchor name generation to use ref content, for example. It will stay stable until ref text unchanged. We probably used the most simple approach by default because the look of stable links is opinion-based and "not nice." Maybe we should add a note with an example to the readme for this case. |
I think your case is not related to this issue. If you have multiple documents on the page, references should have unique prefixes for each document to avoid collisions. See this line markdown-it-footnote/index.mjs Line 12 in fe6c169
Add some |
That's awesome, thank you @puzrin! Works like a dream :-) |
That’s amazing — thank you so much for the help, @puzrin!
That would get an enthusiastic 👍🏻 from me, personally. Thank you again. |
Thanks for making this wonderful plugin!
I’ve been using this for a while, and this is the only place where I keep feeling there is room for improvement.
The syntax allows for specifying footnotes either with an id, or with a number:
However, when markdown is generated, links to footnotes still look like
#fn1
. This has the usual ordered reference problem: if more footnotes are added above a given footnote, its link changes. If it didn't work that way, using ids could have been a nice way to ensure that Cool URIs don’t change. I understand this may not always be desirable, but it could be a sensible default with an option to override it if the current behavior is desired.The text was updated successfully, but these errors were encountered: