Skip to content

Commit 9415fcb

Browse files
committed
fix: improve monaco transform regex
1 parent 94f2dad commit 9415fcb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/slidev/node/plugins/markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function transformMarkdownMonaco(md: string) {
8484
const typeModules = new Set<string>()
8585

8686
// transform monaco
87-
md = md.replace(/\n```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)\n```/mg, (full, lang = 'ts', options: string, code: string) => {
87+
md = md.replace(/^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg, (full, lang = 'ts', options: string, code: string) => {
8888
options = options || ''
8989
lang = lang.trim()
9090
if (lang === 'ts' || lang === 'typescript') {

0 commit comments

Comments
 (0)