@@ -601,38 +601,51 @@ function revealHtmlPostprocessor(
601601 footnoteSection . remove ( ) ;
602602 }
603603 } else {
604- // we are keeping footnotes at the end so disable the links (we use popups)
605- // and tweak the footnotes slide (add a title add smaller/scrollable)
606- const notes = doc . querySelectorAll ( 'a[role="doc-noteref"]' ) ;
607- for ( const note of notes ) {
608- const noteEl = note as Element ;
609- noteEl . setAttribute ( "onclick" , "return false;" ) ;
610- }
604+ let footnotesId : string | undefined ;
611605 const footnotes = doc . querySelectorAll ( 'section[role="doc-endnotes"]' ) ;
612606 if ( footnotes . length === 1 ) {
613607 const footnotesEl = footnotes [ 0 ] as Element ;
608+ footnotesId = footnotesEl ?. getAttribute ( "id" ) || "footnotes" ;
609+ footnotesEl . setAttribute ( "id" , footnotesId ) ;
614610 insertFootnotesTitle ( doc , footnotesEl , format . language , slideLevel ) ;
615611 footnotesEl . classList . add ( "smaller" ) ;
616612 footnotesEl . classList . add ( "scrollable" ) ;
617613 footnotesEl . classList . remove ( "center" ) ;
618614 removeFootnoteBacklinks ( footnotesEl ) ;
619615 }
620- }
621616
622- // disable citation links (we use a popup for them)
623- const cites = doc . querySelectorAll ( 'a[role="doc-biblioref"]' ) ;
624- for ( const cite of cites ) {
625- const citeEl = cite as Element ;
626- citeEl . setAttribute ( "onclick" , "return false;" ) ;
617+ // we are keeping footnotes at the end so disable the links (we use popups)
618+ // and tweak the footnotes slide (add a title add smaller/scrollable)
619+ const notes = doc . querySelectorAll ( 'a[role="doc-noteref"]' ) ;
620+ for ( const note of notes ) {
621+ const noteEl = note as Element ;
622+ noteEl . setAttribute ( "data-footnote-href" , noteEl . getAttribute ( "href" ) ) ;
623+ noteEl . setAttribute ( "href" , footnotesId ? `#/${ footnotesId } ` : "" ) ;
624+ noteEl . setAttribute ( "onclick" , footnotesId ? "" : "return false;" ) ;
625+ }
627626 }
628627
629628 // add scrollable to refs slide
629+ let refsId : string | undefined ;
630630 const refs = doc . querySelector ( "#refs" ) ;
631631 if ( refs ) {
632+ const refsSlide = findParentSlide ( refs ) ;
633+ if ( refsSlide ) {
634+ refsId = refsSlide ?. getAttribute ( "id" ) || "references" ;
635+ refsSlide . setAttribute ( "id" , refsId ) ;
636+ }
632637 applyClassesToParentSlide ( refs , [ "smaller" , "scrollable" ] ) ;
633638 removeClassesFromParentSlide ( refs , [ "center" ] ) ;
634639 }
635640
641+ // handle citation links
642+ const cites = doc . querySelectorAll ( 'a[role="doc-biblioref"]' ) ;
643+ for ( const cite of cites ) {
644+ const citeEl = cite as Element ;
645+ citeEl . setAttribute ( "href" , refsId ? `#/${ refsId } ` : "" ) ;
646+ citeEl . setAttribute ( "onclick" , refsId ? "" : "return false;" ) ;
647+ }
648+
636649 // apply stretch to images as required
637650 applyStretch ( doc , format . metadata [ kAutoStretch ] as boolean ) ;
638651
0 commit comments