From 25e5b6d22730fb146f6c5ee167fc074da97684e3 Mon Sep 17 00:00:00 2001 From: Arshin Sikka Date: Sat, 12 Jul 2025 13:15:14 +0530 Subject: [PATCH 1/2] feat(footnotes): add back-to-reference link for footnotes (#2699) --- .../src/lib/markdown-it/plugins/markdown-it-footnotes.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/core/src/lib/markdown-it/plugins/markdown-it-footnotes.js b/packages/core/src/lib/markdown-it/plugins/markdown-it-footnotes.js index ab192a6682..8ed3fa1221 100644 --- a/packages/core/src/lib/markdown-it/plugins/markdown-it-footnotes.js +++ b/packages/core/src/lib/markdown-it/plugins/markdown-it-footnotes.js @@ -118,13 +118,8 @@ function render_footnote_anchor(tokens, idx, options, env, slf) { id += ':' + tokens[idx].meta.subId; } - // CHANGE HERE - // Below line adds backreferences, but doesn't work well with panels, so disabled for now. - // Old code: - // /* ↩ with escape code to prevent display as Apple Emoji on iOS */ - // return ' \u21a9\uFE0E'; - - return ''; + /* ↩ with escape code to prevent display as Apple Emoji on iOS */ + return ' \u21A9\uFE0E'; } From 0d779e7c7655850077f7bd590ecfa9ba6c03bb43 Mon Sep 17 00:00:00 2001 From: Arshin Sikka Date: Sat, 12 Jul 2025 13:30:05 +0530 Subject: [PATCH 2/2] test(footnotes): add manual back-link test for footnotes (#2699) --- docs/userGuide/syntax/footnotes.md | 13 +++++++++++++ packages/cli/test/functional/test_site/index.md | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/docs/userGuide/syntax/footnotes.md b/docs/userGuide/syntax/footnotes.md index f9600cea95..f6722b5132 100644 --- a/docs/userGuide/syntax/footnotes.md +++ b/docs/userGuide/syntax/footnotes.md @@ -32,6 +32,19 @@ Normal footnotes won't work when used inside the attributes of MarkBind componen For example, it won't work in the `header` attribute of [panels](../components/presentation.html#panels). +### Footnote Back-Link + +Each footnote definition now includes a back-to-reference link (“↩”) +that jumps back to the original marker. + +**Rendered HTML example:** + +```html +Here is a footnote reference,[^1] + +[^1]: This is the footnote. + +
```html diff --git a/packages/cli/test/functional/test_site/index.md b/packages/cli/test/functional/test_site/index.md index 0c3eff0c2f..6d080e499b 100644 --- a/packages/cli/test/functional/test_site/index.md +++ b/packages/cli/test/functional/test_site/index.md @@ -356,3 +356,17 @@ and **this**. {{ code elements should automatically be assigned v-pre }} {% endraw %} + +
+ +

Footnote Back-Link Test

+ +This test verifies that each footnote includes a ↩ link back to its reference. + +Here is a footnote reference,[^1] + +[^1]: This is test content for footnote back-link. + +When rendered, you should see a ↩ after the footnote, and clicking it +should scroll back up to the original marker. +