Skip to content

Commit 0b011a8

Browse files
committed
fix: regex matching options
1 parent b640baa commit 0b011a8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/slidev/node/syntax/transform/mermaid.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { MarkdownTransformContext } from '@slidev/types'
66
*/
77
export function transformMermaid(ctx: MarkdownTransformContext) {
88
ctx.s.replace(
9-
/^```mermaid *(\{[^}]*\})?\n([\s\S]+?)\n```/gm,
9+
/^```mermaid *(\{[^\n]*\})?\n([\s\S]+?)\n```/gm,
1010
(full, options = '', code = '') => {
1111
code = code.trim()
1212
options = options.trim() || '{}'

packages/slidev/node/syntax/transform/monaco.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function transformMonaco(ctx: MarkdownTransformContext) {
1111

1212
// transform monaco
1313
ctx.s.replace(
14-
/^```(\w+) *\{monaco-diff\} *(?:(\{[^\n}]*\}) *)?\n([\s\S]+?)^~~~ *\n([\s\S]+?)^```/gm,
14+
/^```(\w+) *\{monaco-diff\} *(?:(\{[^\n]*\}) *)?\n([\s\S]+?)^~~~ *\n([\s\S]+?)^```/gm,
1515
(full, lang = 'ts', options = '{}', code: string, diff: string) => {
1616
lang = lang.trim()
1717
options = options.trim() || '{}'
@@ -21,7 +21,7 @@ export function transformMonaco(ctx: MarkdownTransformContext) {
2121
},
2222
)
2323
ctx.s.replace(
24-
/^```(\w+) *\{monaco\} *(?:(\{[^}]*\}) *)?\n([\s\S]+?)^```/gm,
24+
/^```(\w+) *\{monaco\} *(?:(\{[^\n]*\}) *)?\n([\s\S]+?)^```/gm,
2525
(full, lang = 'ts', options = '{}', code: string) => {
2626
lang = lang.trim()
2727
options = options.trim() || '{}'
@@ -30,7 +30,7 @@ export function transformMonaco(ctx: MarkdownTransformContext) {
3030
},
3131
)
3232
ctx.s.replace(
33-
/^```(\w+) *\{monaco-run\} *(?:(\{[^}]*\}) *)?\n([\s\S]+?)^```/gm,
33+
/^```(\w+) *\{monaco-run\} *(?:(\{[^\n]*\}) *)?\n([\s\S]+?)^```/gm,
3434
(full, lang = 'ts', options = '{}', code: string) => {
3535
lang = lang.trim()
3636
options = options.trim() || '{}'

0 commit comments

Comments
 (0)