-
Notifications
You must be signed in to change notification settings - Fork 18
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
Default anchorPattern
selects too many links when URI contains (fn|footnote|note)
#1824
Comments
The setup still tries to match the URL fragment with an existing footnote at the bottom at the document, though. So while it is less efficient because it picks too many link candidates, I suspect it will not lead to incorrect footnotes being created. But I could be wrong... do you have a counter example? |
Hey @goblindegook - sorry I should be more clear, it causes the footnote matching to fail entirely so none of the footnotes are converted by littlefoot. The document remains unmodified. The footnote matching code emits the following error:
because littlefoot/src/dom/document.ts Lines 82 to 85 in b2f470f
|
Thank you, that's clear now. I'll work on a fix. |
The default
anchorPattern
is/(fn|footnote|note)[:\-_\d]/gi
. This could select too many links when the URI of the page contains the stringsfn
,footnote
, ornote
.For example, a page containing the following element is served at
https://footnote.example.com/
:Then in the following code,
pattern
will match becauselink.href
ishttps://footnote.example.com/#
littlefoot/src/dom/document.ts
Lines 69 to 71 in b2f470f
I believe this can be fixed by setting the default
anchorPattern
to/#(fn|footnote|note)[:\-_\d]/gi
The text was updated successfully, but these errors were encountered: