@@ -28,14 +28,12 @@ function replaceMatches(str: string, regex: RegExp, replacer: (match: RegExpExec
2828 return accumulator
2929}
3030
31-
3231const wikilinkRegex = / \[ \[ (?< link > [ ^ | \] ] + ) \| ? ( (?< displayText > [ ^ \] ] + ) ) ? \] \] / g
3332
3433function replacement ( match ) {
3534 const { link, displayText } = match . groups !
36- const safeLink = link . trim ( ) . replace ( / \s + / g, "-" )
37- // return `<a href=\"/${safeLink}\">${displayText || link}</a>`
38- return `${ displayText || link } `
35+ const safeLink = `quartz-${ link . trim ( ) . replace ( / \s + / g, "-" ) } `
36+ return `<a href=\"/${ safeLink } \">${ displayText || link } </a>`
3937}
4038
4139export const parseInternalLinks = recurseChildren ( node => {
@@ -46,6 +44,7 @@ export const parseInternalLinks = recurseChildren(node => {
4644
4745const MarkmapViewer : QuartzComponent = ( { displayClass, fileData } : QuartzComponentProps ) => {
4846 const root = fileData . markmap
47+
4948 if ( ! root ) {
5049 return (
5150 < div class = { classNames ( displayClass , "markmap" ) } >
@@ -94,15 +93,13 @@ const MarkmapViewer: QuartzComponent = ({ displayClass, fileData }: QuartzCompon
9493 < path d = "M200-80q-50 0-85-35t-35-85q0-39 22.5-70t57.5-43v-87q0-50 35-85t85-35h160v-127q-35-12-57.5-43T360-760q0-50 35-85t85-35q50 0 85 35t35 85q0 39-22.5 70T520-647v127h160q50 0 85 35t35 85v87q35 12 57.5 43t22.5 70q0 50-35 85t-85 35q-50 0-85-35t-35-85q0-39 22.5-70t57.5-43v-87q0-17-11.5-28.5T680-440H520v127q35 12 57.5 43t22.5 70q0 50-35 85t-85 35q-50 0-85-35t-35-85q0-39 22.5-70t57.5-43v-127H280q-17 0-28.5 11.5T240-400v87q35 12 57.5 43t22.5 70q0 50-35 85t-85 35Zm0-80q17 0 28.5-11.5T240-200q0-17-11.5-28.5T200-240q-17 0-28.5 11.5T160-200q0 17 11.5 28.5T200-160Zm280 0q17 0 28.5-11.5T520-200q0-17-11.5-28.5T480-240q-17 0-28.5 11.5T440-200q0 17 11.5 28.5T480-160Zm280 0q17 0 28.5-11.5T800-200q0-17-11.5-28.5T760-240q-17 0-28.5 11.5T720-200q0 17 11.5 28.5T760-160ZM480-720q17 0 28.5-11.5T520-760q0-17-11.5-28.5T480-800q-17 0-28.5 11.5T440-760q0 17 11.5 28.5T480-720Z" />
9594 </ svg >
9695 </ button >
97- < div class = "global-markmap-outer" >
98- < div class = "global-markmap-container" >
96+ < div
97+ class = "global-markmap-outer"
98+ data-markmap = { encodeURIComponent ( JSON . stringify ( fileData . markmap ) ) }
99+ >
100+ < div class = "global-markmap-container" >
99101 < svg id = "global-markmap" > </ svg >
100102 < div id = "global-markmap-toolbar" > </ div >
101- < script
102- id = "global-markmap-data"
103- type = "application/json"
104- dangerouslySetInnerHTML = { { __html : JSON . stringify ( fileData . markmap ) } }
105- />
106103 </ div >
107104 </ div >
108105 </ div >
0 commit comments