Skip to content

Commit

Permalink
Merge branch 'main' into feat/magic-string-stack
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 17, 2024
2 parents b0b1f7f + e8a14c7 commit 0373869
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/slidev/node/vite/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export async function createMarkdownPlugin(
},
})

md.use(MarkdownItEscapeInlineCode)
md.use(MarkdownItFootnote)
md.use(MarkdownItTaskList, { enabled: true, lineNumber: true, label: true })
md.use(MarkdownItKatex, KatexOptions)
Expand Down Expand Up @@ -175,3 +176,11 @@ export function applyMarkdownTransform(

return ctx
}

function MarkdownItEscapeInlineCode(md: MarkdownIt) {
const codeInline = md.renderer.rules.code_inline!
md.renderer.rules.code_inline = (tokens, idx, options, env, self) => {
const result = codeInline(tokens, idx, options, env, self)
return result.replace(/^<code/, '<code v-pre')
}
}

0 comments on commit 0373869

Please sign in to comment.