@@ -319,7 +319,7 @@ export function MarkdownFormatter({ markdown, backgroundColor, dict, pSize }) {
319319 . props . children . find (
320320 ( child ) => child ?. props ?. node . tagName === "a" ,
321321 ) . props . node . properties . href ;
322- value = footnoteLinkBack . split ( "-" ) . pop ( ) ;
322+ value = footnoteLinkBack ? .split ( "-" ) . pop ( ) || "" ;
323323 validValue = / ^ - ? \d + $ / . test ( value ) ;
324324 } catch ( e ) {
325325 // Do nothing
@@ -369,7 +369,7 @@ export function MarkdownFormatter({ markdown, backgroundColor, dict, pSize }) {
369369 // If href=#user-content-fn-1, id should be user-content-fnref-1 and vice versa
370370 if ( href . startsWith ( "#user-content-fn-" ) ) {
371371 id = href . replace ( "#user-content-fn-" , "user-content-fnref-" ) ;
372- footnoteNumber = parseInt ( id . split ( "-" ) . pop ( ) ) ;
372+ footnoteNumber = parseInt ( id ? .split ( "-" ) . pop ( ) || "0" ) ;
373373 } else if ( href . startsWith ( "#user-content-fnref-" ) ) {
374374 id = href . replace ( "#user-content-fnref-" , "user-content-fn-" ) ;
375375 } else {
@@ -475,7 +475,7 @@ export function MarkdownFormatter({ markdown, backgroundColor, dict, pSize }) {
475475 }
476476 } ,
477477 h2 : ( { children : headerText } ) => {
478- if ( ! headerText . split ) {
478+ if ( ! headerText ? .split ) {
479479 headerText = "" ;
480480 }
481481 // Remove slashes and commas, and replace spaces with dashes to create a
0 commit comments