File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
packages/notion-shiki-code/src/server Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1- import type { Lang , Theme } from "shiki" ;
1+ import { BUNDLED_LANGUAGES , type Lang , type Theme } from "shiki" ;
22import {
33 getTextFromRichText ,
44 type BlockObjectResponse ,
@@ -90,7 +90,14 @@ export async function shikifyNotionBlock(
9090 ...blockOptions ,
9191 } ;
9292
93- const language = options . language ?? ( block . code . language as Lang ) ;
93+ let language = options . language ?? ( block . code . language as Lang ) ;
94+ if (
95+ ! BUNDLED_LANGUAGES . some (
96+ ( bundledLanguage ) => bundledLanguage . id === language
97+ )
98+ )
99+ ( language as string ) = "" ;
100+
94101 const { codeHtml, foregroundColor, backgroundColor } = await shikiTransform (
95102 getTextFromRichText ( block . code . rich_text ) ,
96103 { ...options , language }
You can’t perform that action at this time.
0 commit comments