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-');
66
77// scroll to anchor while respecting the `user-content` prefix that exists on the target
88function 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 } ` ) ;
@@ -55,6 +56,7 @@ export function initMarkupAnchors(): void {
5556
5657 for ( const a of markupEl . querySelectorAll < HTMLAnchorElement > ( 'a[href^="#"]' ) ) {
5758 a . addEventListener ( 'click' , ( e ) => {
59+ console . log ( e . currentTarget )
5860 scrollToAnchor ( ( e . currentTarget as HTMLAnchorElement ) . getAttribute ( 'href' ) ?. substring ( 1 ) ) ;
5961 } ) ;
6062 }
You can’t perform that action at this time.
0 commit comments