diff --git a/src/node/markdown/plugins/highlight.ts b/src/node/markdown/plugins/highlight.ts index eb27b559..9d1c50df 100644 --- a/src/node/markdown/plugins/highlight.ts +++ b/src/node/markdown/plugins/highlight.ts @@ -5,23 +5,25 @@ export async function highlight(theme: ThemeOptions = 'material-palenight') { const themes = typeof theme === 'string' ? [theme] : [theme.dark, theme.light] const highlighter = await getHighlighter({ themes }) const preRE = /^
') + .replace(preRE, ``) } const dark = highlighter .codeToHtml(str, { lang, theme: theme.dark }) - .replace(preRE, '') + .replace(preRE, ``) const light = highlighter .codeToHtml(str, { lang, theme: theme.light }) - .replace(preRE, '') + .replace(preRE, ``) return dark + light } diff --git a/src/node/markdown/plugins/preWrapper.ts b/src/node/markdown/plugins/preWrapper.ts index 9a0d4ef7..9d51874d 100644 --- a/src/node/markdown/plugins/preWrapper.ts +++ b/src/node/markdown/plugins/preWrapper.ts @@ -13,7 +13,7 @@ export const preWrapperPlugin = (md: MarkdownIt) => { const fence = md.renderer.rules.fence! md.renderer.rules.fence = (...args) => { const [tokens, idx] = args - const lang = tokens[idx].info.trim() + const lang = tokens[idx].info.trim().replace(/-vue$/, '') const rawCode = fence(...args) return `${ lang === 'vue-html' ? 'template' : lang