From a1ced36553cc9f5f6e321c460aee90865ac8bf38 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:34:09 +0530 Subject: [PATCH] chore: override text renderer before calling user config --- .gitignore | 1 + src/node/markdown/markdown.ts | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 81c00934..64331052 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ examples-temp node_modules pnpm-global TODOs.md +*.timestamp-*.mjs diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 0d75b6ce..199980ba 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -206,6 +206,11 @@ export const createMarkdownRenderer = async ( md.linkify.set({ fuzzyLink: false }) + // disable entity decode/escape from markdown-it, as the Vue compiler already + // decodes them. + md.disable('entity') + md.renderer.rules.text = (tokens, idx) => tokens[idx].content + if (options.preConfig) { options.preConfig(md) } @@ -292,10 +297,5 @@ export const createMarkdownRenderer = async ( options.config(md) } - // disable entity decode/escape from markdown-it, as the Vue compiler already - // decodes them. - md.disable('entity') - md.renderer.rules.text = (tokens, idx) => tokens[idx].content - return md }