Skip to content

Commit 78a812b

Browse files
yuyinwsautofix-ci[bot]antfu
authored
fix: code block error match when includes twoslash (#2252)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Anthony Fu <[email protected]>
1 parent 90ca617 commit 78a812b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/slidev/node/syntax/transform/code-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { MarkdownTransformContext } from '@slidev/types'
22
import { normalizeRangeStr } from './utils'
33

44
// eslint-disable-next-line regexp/no-super-linear-backtracking
5-
export const reCodeBlock = /^```([\w'-]+)?\s*(?:\[(.*?)\])?\s*(?:\{([\w*,|-]+)\}\s*?(\{[^}]*\})?([^\r\n]*))?\r?\n([ \t]*\S[\s\S]*?)^```$/gm
5+
export const reCodeBlock = /^```([\w'-]+)?\s*(?:\[(.*?)\])?\s*(?:\{([\w*,|-]+)\}\s*?(\{[^}]*\})?([^\r\n]*))?\r?\n((?:(?!^```)[\s\S])*?)^```$/gm
66

77
/**
88
* Transform code block with wrapper

0 commit comments

Comments
 (0)