File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,15 @@ export async function highlight({
4747 await highlighter . loadTheme ( theme as IShikiTheme )
4848 }
4949 if ( missingLang ( highlighter , lang ) ) {
50- await highlighter . loadLanguage ( lang as Lang )
50+ try {
51+ await highlighter . loadLanguage ( lang as Lang )
52+ } catch ( e ) {
53+ console . warn (
54+ "[Code Hike warning]" ,
55+ `${ lang } is not a valid language, no syntax highlighting will be applied.`
56+ )
57+ return highlight ( { code, lang : "text" , theme } )
58+ }
5159 }
5260
5361 const tokenizedLines = highlighter . codeToThemedTokens (
Original file line number Diff line number Diff line change @@ -6,6 +6,14 @@ function lorem(ipsum, dolor = 1) {
66}
77```
88
9+ ``` mermaid
10+ graph LR
11+ Start1(Start)
12+ --Bot 启动--> check1[检查群内的非 Authing 用户]
13+ --> addUser[添加 Authing 用户并消息提醒绑定手机号]
14+ --> End1(End)
15+ ```
16+
917``` js
1018function lorem (ipsum , dolor = 1 ) {}
1119```
You can’t perform that action at this time.
0 commit comments