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
Parsing internal wiki link to footnote generates incorrect URL #1968
Comments
This problem still exists today. Here is the root cause analysis. The link is processed here in \Doku_Handler::internallink() dokuwiki/inc/parser/handler.php Lines 880 to 885 in 95078f2
resulting in the following stack trace
and of course cleanID removes repeated separator characters Line 160 in 95078f2
I'm not sure what the proper fix should be. Since we know that it's an internal link, do we actually need to call _headerToLink() ? After all the input is NOT a header so would it be OK to just get rid of line 851 ? Or am I missing something ? Lines 847 to 852 in 95078f2
|
Still not fixed in Kaos. If someone who knows better can answer my question, I will gladly submit a PR.
|
The intended purpose of this kind of link syntax is to link to a heading in the page. The code applies the same transformation as for heading IDs such that the user can simply supply the text of the heading and the code ensures that the link points to the heading. Other IDs in DokuWiki are intentionally not following the pattern for heading IDs to ensure that they won't conflict with the ID of any heading. I don't know which IDs would be worth supporting in addition to headings. If footnotes are the only ones, the code could check if the supplied text matches the pattern of a footnote ID and use it directly. I think the double underscore pattern is quite frequent in IDs outside of headings so checking for that could also be an option but this could more easily break a link that should actually point to a heading. |
Many thanks for the feedback. I never realized until you mentioned it that it was possible to make links like This feature is probably more important and widely used than my need to reference an existing footnote, and it probably should not be touched. So if I understand correctly, achieving what I need may require introduction of a new type of links, e.g. Alternatively, what about introducing a specific syntax to reference a footnote, like
Which could render like this
Let me know what you think. |
Note: I am aware that I can do
And it will generate a single footnote with 2 references
What I'm trying to avoid is duplication of the footnote's contents. |
Whenever you insert or remove a footnote the numbering will be adjusted for all following footnotes. Thus permalinks that contain the number of the footnote are not really very useful (unless they are used and maintained automatically). What you would need is some (user provided) unique id in the footnote syntax. For example something like this (the exact syntax probably needs work):
Issues:
|
@fiwswe summarized the challenges pretty well. DokuWiki's default syntax for footnotes is deliberately simple and I would prefer to keep it that way. For more complex footnotes, I used the refnotes plugin in the past. |
OK I understand. Thanks to all for taking the time to reply, and @andi for the pointer to the refnotes plugin, I'll check it out. |
@dregad I took a brief look at the RefNotes Plugin documentation. While it does not seem to solve all of the potential issues it does allow for named footnotes that don't need to be repeated (see Multiple references and Named notes). So they may solve your basic problem. I have been annoyed by having to repeat footnotes as well, but I could not come up with a good solution. |
Thanks for the follow-up @fiwswe, I appreciate it. Looks like this plugin will precisely meet the requirement. |
Direct link to footnote
[[#fn__1]]
the double underscore__
is replaced by a single one in the generated link so it does not match the actual anchorExample: https://www.dokuwiki.org/sandbox:footnote_link
The text was updated successfully, but these errors were encountered: