Skip to content

Commit

Permalink
fix: line highlighter without options
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 14, 2021
1 parent 1cf81a7 commit 9c98440
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/client/builtin/CodeHighlightController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const props = defineProps({
default: () => [],
},
at: {
type: Number,
default: undefined,
},
})
Expand Down
2 changes: 1 addition & 1 deletion packages/slidev/node/plugins/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function truncateMancoMark(code: string) {
* Transform Monaco code block to component
*/
export function transformHighlighter(md: string) {
return md.replace(/^```(\w+?)\s*{([\d\w*,\|-]+)}\s*({.*?})[\s\n]*([\s\S]+?)^```/mg, (full, lang = '', rangeStr: string, options = '', code: string) => {
return md.replace(/^```(\w+?)\s*{([\d\w*,\|-]+)}\s*?({.*?})?\s*?\n([\s\S]+?)^```/mg, (full, lang = '', rangeStr: string, options = '', code: string) => {
const ranges = rangeStr.split(/\|/g).map(i => i.trim())
code = code.trimEnd()
options = options.trim() || '{}'
Expand Down

0 comments on commit 9c98440

Please sign in to comment.