From 80675b29212b7da03b7151147b74855967a6da7a Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Tue, 26 Apr 2022 16:14:28 +0800 Subject: [PATCH] =?UTF-8?q?C++=E3=80=81C#=E4=BB=A3=E7=A0=81=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getPostBlocks.js | 10 ++++++++++ pages/_app.js | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) 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'