From 24989691066acf6b37131ac1aa4f07cb536696d4 Mon Sep 17 00:00:00 2001 From: expoli <31023767+expoli@users.noreply.github.com> Date: Wed, 18 Jan 2023 09:51:25 +0800 Subject: [PATCH 01/18] =?UTF-8?q?[update]=20=E6=B7=BB=E5=8A=A0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=A1=8C=E5=8F=B7=E6=98=BE=E7=A4=BA=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=EF=BC=8C=E5=8F=96=E6=B6=88=E8=A1=8C=E5=8F=B7=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=B0=86=E4=BB=A3=E7=A0=81=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E6=BB=91=E5=8A=A8=EF=BC=8C=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=A1=8C=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 1 + components/PrismMac.js | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/blog.config.js b/blog.config.js index 653d3fe3..2c48088d 100644 --- a/blog.config.js +++ b/blog.config.js @@ -43,6 +43,7 @@ const BLOG = { // PrismJs CDN PRISM_JS_PATH: 'https://npm.elemecdn.com/prismjs@1.29.0/components/', + CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || 'false', BACKGROUND_LIGHT: '#eeeeee', // use hex value, don't forget '#' e.g #fffefc BACKGROUND_DARK: '#000000', // use hex value, don't forget '#' diff --git a/components/PrismMac.js b/components/PrismMac.js index 11673d46..41d5e588 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -73,16 +73,17 @@ function renderPrismMac() { const container = document?.getElementById('container-inner') // Add line numbers - const codeBlocks = container?.getElementsByTagName('pre') - if (codeBlocks) { - Array.from(codeBlocks).forEach(item => { - if (!item.classList.contains('line-numbers')) { - item.classList.add('line-numbers') - item.style.whiteSpace = 'pre-wrap' - } - }) + if (BLOG.CODE_LINE_NUMBERS === 'true') { + const codeBlocks = container?.getElementsByTagName('pre') + if (codeBlocks) { + Array.from(codeBlocks).forEach(item => { + if (!item.classList.contains('line-numbers')) { + item.classList.add('line-numbers') + item.style.whiteSpace = 'pre-wrap' + } + }) + } } - // 重新渲染之前检查所有的多余text try { From 22c3aa9aee5080e1b2ca44b6730693e347dbe248 Mon Sep 17 00:00:00 2001 From: expoli <31023767+expoli@users.noreply.github.com> Date: Sat, 31 Dec 2022 18:41:58 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E6=8F=90=E5=8D=87=20utterances=20?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9A=84=20issue=20=E5=8F=AF=E8=BE=A8?= =?UTF-8?q?=E8=AF=86=E5=BA=A6=EF=BC=88=E4=BD=BF=E7=94=A8=E6=96=87=E7=AB=A0?= =?UTF-8?q?=20title=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit b676786cd2a5277db79ecc1d803ea8017a1a81be) --- components/Utterances.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Utterances.js b/components/Utterances.js index 82b5d60c..e0298daf 100644 --- a/components/Utterances.js +++ b/components/Utterances.js @@ -22,7 +22,7 @@ const Utterances = ({ issueTerm, layout }) => { script.setAttribute('crossorigin', 'anonymous') script.setAttribute('async', true) script.setAttribute('repo', BLOG.COMMENT_UTTERRANCES_REPO) - script.setAttribute('issue-term', issueTerm) + script.setAttribute('issue-term', 'title') script.setAttribute('theme', theme) anchor.appendChild(script) return () => { From 88bd9c71f0f21aa4088081afacac1182a7f92528 Mon Sep 17 00:00:00 2001 From: Etherrreal <65111206+lifeafter619@users.noreply.github.com> Date: Wed, 18 Jan 2023 11:30:15 +0800 Subject: [PATCH 03/18] Update Player.js --- components/Player.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/Player.js b/components/Player.js index c85b30a0..5bb0b70c 100644 --- a/components/Player.js +++ b/components/Player.js @@ -32,12 +32,14 @@ const Player = () => { {meting ? Date: Wed, 18 Jan 2023 11:39:47 +0800 Subject: [PATCH 04/18] Update CommonScript.js --- components/CommonScript.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/CommonScript.js b/components/CommonScript.js index 446b0017..954c9f48 100644 --- a/components/CommonScript.js +++ b/components/CommonScript.js @@ -103,7 +103,7 @@ const CommonScript = () => { )} {/* 引入音乐播放 */} - {JSON.parse(BLOG.MUSIC_PLAYER) &&