File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ const hasPrefix = (str: string): boolean => str.startsWith('user-content-');
6
6
7
7
// scroll to anchor while respecting the `user-content` prefix that exists on the target
8
8
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 ;
10
11
const id = decodeURIComponent ( encodedId ) ;
11
12
const prefixedId = addPrefix ( id ) ;
12
13
let el = document . querySelector ( `#${ prefixedId } ` ) ;
@@ -55,6 +56,7 @@ export function initMarkupAnchors(): void {
55
56
56
57
for ( const a of markupEl . querySelectorAll < HTMLAnchorElement > ( 'a[href^="#"]' ) ) {
57
58
a . addEventListener ( 'click' , ( e ) => {
59
+ console . log ( e . currentTarget )
58
60
scrollToAnchor ( ( e . currentTarget as HTMLAnchorElement ) . getAttribute ( 'href' ) ?. substring ( 1 ) ) ;
59
61
} ) ;
60
62
}
You can’t perform that action at this time.
0 commit comments