Skip to content

Commit f8de6b0

Browse files
committed
Fix JavaScript error when clicking a footnote link.
1 parent f028f45 commit f8de6b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

web_src/js/markup/anchors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const hasPrefix = (str: string): boolean => str.startsWith('user-content-');
66

77
// scroll to anchor while respecting the `user-content` prefix that exists on the target
88
function scrollToAnchor(encodedId: string): void {
9-
if (!encodedId) return;
9+
// Ignore the footnote case, as the link is rendered by the backend.
10+
if (!encodedId || encodedId.startsWith('fn:') || encodedId.startsWith('fnref:')) return;
1011
const id = decodeURIComponent(encodedId);
1112
const prefixedId = addPrefix(id);
1213
let el = document.querySelector(`#${prefixedId}`);

0 commit comments

Comments
 (0)