diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 72d83fb8..457af734 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -23,7 +23,7 @@ const markdownItOptions = { breaks: true, linkify: false, typographer: true, - quotes: '\u{E9b0}\u{E9b1}\u{E9b2}\u{E9b3}', //placeholder characters to convert to real quotes + quotes: '“”‘’', } const md = markdownit(markdownItOptions) @@ -79,18 +79,18 @@ DOMPurify.addHook("uponSanitizeAttribute", (node, data) => { function renderMarkdown(data:string){ return md.render(data) - .replace(/\uE9b0/gu, '“') - .replace(/\uE9b1/gu, '”') - .replace(/\uE9b2/gu, '‘') - .replace(/\uE9b3/gu, '’') + .replace(/“/gu, '“') + .replace(/”/gu, '”') + .replace(/‘/gu, '‘') + .replace(/’/gu, '’') } async function renderHighlightableMarkdown(data:string) { let rendered = mdHighlight.render(data) - .replace(/\uE9b0/gu, '“') - .replace(/\uE9b1/gu, '”') - .replace(/\uE9b2/gu, '‘') - .replace(/\uE9b3/gu, '’') + .replace(/“/gu, '“') + .replace(/”/gu, '”') + .replace(/‘/gu, '‘') + .replace(/’/gu, '’') console.log(rendered) const highlightPlaceholders = rendered.match(/(.+?)<\/pre-hljs-placeholder>/gms) console.log(highlightPlaceholders)