markbind icon indicating copy to clipboard operation
markbind copied to clipboard

Add a "back" link for footnotes

Open AgentHagu opened this issue 8 months ago • 4 comments

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

No response

What is the area that this feature belongs to?

Reader Usability

Is your feature request related to a problem? Please describe.

Current behavior: When a reader clicks a footnote link, the page scrolls down to the corresponding footnote content at the bottom of the page. However, there is no link to take the reader back to where that footnote was mentioned in the main text.

Why this is an issue:

  • Readers may not realize they can use their browser's back button to return to the reference since it may not be obvious or intuitive

  • It's also difficult for readers to locate where a particular footnote is reference if they're browsing the footnotes directly. For example, it's not easy for readers to tell where the 4th footnote ("Math") was mentioned without scrolling through or using ctrl-F:

    Image

Describe the solution you'd like

Add a "back to reference" link, e.g. , next to each footnote at the bottom of the page. This link would scroll the reader back to the original spot in the page where that footnote was referenced.

An example we could follow is GFMD's footnotes: Image

This would improve navigation and make the reading experience smoother and more intuitive, especially for long reference-heavy documents that MarkBind caters to.

Describe alternatives you've considered

No response

Additional context

No response

AgentHagu avatar Apr 17 '25 07:04 AgentHagu

Hey there, I looked into this and found that #1320 removed footnote backreferences in core/src/lib/markdown-it/plugins/markdown-it-footnote.js. However, the author of the file mentioned that backreferences were originally disabled because it "doesn't work well with panels".

I've made some changes in the aforementioned file which reintroduced it back. Since I used part of the old implementation, this might cause some regressions.

Additionally, a quirk of this change is that clicking on backreferences will cause the page to scroll back until the element is at the top of the screen - hiding the backreferenced footnote underneath the page header. For that I think a potential fix for that could be implemented through the scroll-padding-top CSS property for footnote element.

Coziyu avatar Jun 04 '25 13:06 Coziyu

Thank you for looking into this issue @Coziyu! Glad to see you found a potential fix!

Hey there, I looked into this and found that https://github.com/MarkBind/markbind/pull/1320 removed footnote backreferences in core/src/lib/markdown-it/plugins/markdown-it-footnote.js. However, the author of the file mentioned that backreferences were originally disabled because it "doesn't work well with panels".

I see, that's interesting that it originally existed but was removed. Personally, I think this would be a good feature to reintroduce for better reader navigability. I'm open to hear others' thoughts on whether it's worth reintroducing.

AgentHagu avatar Jun 04 '25 16:06 AgentHagu

Hi, I’m contributing as part of the NUS-OSS summer project (CP3108B). May I work on this issue if it not outdated yet?

arshinsikka avatar Jun 26 '25 10:06 arshinsikka

Hi @arshinsikka, thanks for your interest! I believe the issue is still relevant so I'll assign you to this issue, feel free to work on it. Remember to take a look through our developer guide!

AgentHagu avatar Jun 26 '25 14:06 AgentHagu