diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 52cbdf32..38f003b4 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -49,6 +49,16 @@ function filterPostBlocks(id, pageBlock, slice) { continue } count++ + // 处理 c++ 和 c#两种语言 + if (b?.value?.type === 'code') { + if (b?.value?.properties?.language?.[0][0] === 'C++') { + b.value.properties.language[0][0] = 'cpp' + } + if (b?.value?.properties?.language?.[0][0] === 'C#') { + b.value.properties.language[0][0] = 'csharp' + } + } + delete b?.role delete b?.value?.version delete b?.value?.created_by_table diff --git a/pages/_app.js b/pages/_app.js index d9ae363f..779a81eb 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -8,9 +8,7 @@ import '@/styles/notion.css' // 重写部分样式 // used for collection views (optional) // import 'rc-dropdown/assets/index.css' -// used for code syntax highlighting (optional) -import 'prismjs/themes/prism-okaidia.css' -// used for rendering equations (optional) +import 'prismjs/themes/prism-tomorrow.min.css' import 'react-notion-x/build/third-party/equation.css' import dynamic from 'next/dynamic'