mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-01 07:26:47 +00:00
code 调整
This commit is contained in:
@@ -112,7 +112,7 @@ const BLOG = {
|
|||||||
PRISM_THEME_DARK_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.min.css', // 深色模式主题
|
PRISM_THEME_DARK_PATH: 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-okaidia.min.css', // 深色模式主题
|
||||||
|
|
||||||
CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标
|
CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标
|
||||||
CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || 'false', // 是否显示行号
|
CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || false, // 是否显示行号
|
||||||
CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否折叠代码框
|
CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否折叠代码框
|
||||||
// END********代码相关********
|
// END********代码相关********
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ function renderPrismMac() {
|
|||||||
const container = document?.getElementById('notion-article')
|
const container = document?.getElementById('notion-article')
|
||||||
|
|
||||||
// Add line numbers
|
// Add line numbers
|
||||||
if (BLOG.CODE_LINE_NUMBERS === 'true') {
|
if (JSON.parse(BLOG.CODE_LINE_NUMBERS)) {
|
||||||
const codeBlocks = container?.getElementsByTagName('pre')
|
const codeBlocks = container?.getElementsByTagName('pre')
|
||||||
if (codeBlocks) {
|
if (codeBlocks) {
|
||||||
Array.from(codeBlocks).forEach(item => {
|
Array.from(codeBlocks).forEach(item => {
|
||||||
@@ -192,7 +192,7 @@ function renderPrismMac() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 折叠代码行号bug
|
// 折叠代码行号bug
|
||||||
if (BLOG.CODE_LINE_NUMBERS === 'true') {
|
if (JSON.parse(BLOG.CODE_LINE_NUMBERS)) {
|
||||||
fixCodeLineStyle()
|
fixCodeLineStyle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user