Skip to content

Commit 9c98440

Browse files
committed
fix: line highlighter without options
1 parent 1cf81a7 commit 9c98440

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/client/builtin/CodeHighlightController.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const props = defineProps({
2222
default: () => [],
2323
},
2424
at: {
25+
type: Number,
2526
default: undefined,
2627
},
2728
})

packages/slidev/node/plugins/markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function truncateMancoMark(code: string) {
101101
* Transform Monaco code block to component
102102
*/
103103
export function transformHighlighter(md: string) {
104-
return md.replace(/^```(\w+?)\s*{([\d\w*,\|-]+)}\s*({.*?})[\s\n]*([\s\S]+?)^```/mg, (full, lang = '', rangeStr: string, options = '', code: string) => {
104+
return md.replace(/^```(\w+?)\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = '', rangeStr: string, options = '', code: string) => {
105105
const ranges = rangeStr.split(/\|/g).map(i => i.trim())
106106
code = code.trimEnd()
107107
options = options.trim() || '{}'

0 commit comments

Comments
 (0)