Skip to content

Commit 6034f8c

Browse files
author
Tdahuyou
committed
📝 Update notes - 2025-11-04 22:46:39
1 parent 30a032d commit 6034f8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5240
-1672
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
MERGED_README.md
2+
.vitepress-pid
23

34
# 忽略视频|音频文件
45
*.mp3
@@ -52,7 +53,6 @@ out/
5253

5354
# 忽略Gradle构建系统产生的文件
5455
.gradle/
55-
build/
5656
.gradle/*
5757

5858
# 忽略Docker容器和镜像
@@ -88,7 +88,8 @@ tmp/
8888
*.min.css
8989
*.map
9090

91-
91+
# 忽略 VitePress 临时文件
92+
.vitepress/**/*.timestamp-*.mjs
9293

9394
# 忽略词典数据解析后生成的文件
9495
results

.tnotes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,6 @@
7878
"icon": "github"
7979
}
8080
],
81-
"id": "f7674e4d-9c1b-424e-b1dc-bcef54a50a8b"
81+
"id": "f7674e4d-9c1b-424e-b1dc-bcef54a50a8b",
82+
"sidebarShowNoteId": true
8283
}

.vitepress/components/Layout/Layout.module.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,21 @@
278278
font-family: var(--vp-font-family-mono);
279279
}
280280

281+
/* GitHub 链接样式 */
282+
.githubLink {
283+
color: var(--vp-c-brand-1);
284+
text-decoration: none;
285+
transition: all 0.2s ease;
286+
display: inline-flex;
287+
align-items: center;
288+
gap: 0.25rem;
289+
290+
&:hover {
291+
color: var(--vp-c-brand-2);
292+
text-decoration: underline;
293+
}
294+
}
295+
281296
/* 宽屏样式:在 >=720px 时,改为左右两栏布局 */
282297
@media (min-width: 720px) {
283298
.timeModalContent {

.vitepress/components/Layout/Layout.vue

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@
4343
<img :src="icon__vscode" alt="open in vscode" />
4444
</a>
4545
</div>
46-
<!-- 笔记的 GitHub 链接(移动端和 PC 端都显示) -->
47-
<div :class="$style.githubNoteBox" v-show="currentNoteGithubUrl">
48-
<a
49-
:href="currentNoteGithubUrl"
50-
aria-label="在 GitHub 上查看此笔记"
51-
title="在 GitHub 上查看此笔记"
52-
target="_blank"
53-
rel="noopener"
54-
>
55-
<img :src="icon__github" alt="github icon" />
56-
</a>
57-
</div>
5846
<div :class="[$style.contentToggleBox, $style.pcOnly]">
5947
<ToggleFullContent />
6048
</div>
@@ -122,6 +110,26 @@
122110
role="group"
123111
aria-label="笔记提交信息"
124112
>
113+
<div
114+
:class="$style.timeLine"
115+
v-if="currentNoteGithubUrl"
116+
title="在 GitHub 中打开当前笔记"
117+
>
118+
<div :class="$style.timeLabel">
119+
<strong>🔗 GitHub 链接</strong>
120+
</div>
121+
<div :class="$style.timeValue">
122+
<a
123+
:href="currentNoteGithubUrl"
124+
target="_blank"
125+
rel="noopener"
126+
:class="$style.githubLink"
127+
>
128+
在 GitHub 中打开当前笔记
129+
</a>
130+
</div>
131+
</div>
132+
125133
<div :class="$style.timeLine" title="首次提交时间">
126134
<div :class="$style.timeLabel"><strong>⌛️ 首次提交</strong></div>
127135
<div :class="$style.timeValue">{{ formatDate(created_at) }}</div>

.vitepress/components/Settings/Settings.module.scss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,52 @@ input[type='number'] {
415415
/* ===================================== */
416416
/* #endregion 响应式设计 */
417417
/* ===================================== */
418+
419+
/* ===================================== */
420+
/* #region 内容宽度配置 */
421+
/* ===================================== */
422+
.widthOptions {
423+
display: flex;
424+
gap: 12px;
425+
margin-top: 8px;
426+
}
427+
428+
.widthBtn {
429+
flex: 1;
430+
padding: 12px 16px;
431+
border: 2px solid var(--vp-c-divider);
432+
border-radius: 8px;
433+
background: var(--vp-c-bg);
434+
color: var(--vp-c-text-2);
435+
font-size: 14px;
436+
font-weight: 500;
437+
cursor: pointer;
438+
transition: all 0.2s ease;
439+
display: flex;
440+
align-items: center;
441+
justify-content: center;
442+
gap: 6px;
443+
444+
&:hover {
445+
border-color: var(--vp-c-brand-1);
446+
color: var(--vp-c-brand-1);
447+
background: var(--vp-c-bg-alt);
448+
transform: translateY(-1px);
449+
box-shadow: 0 2px 8px rgba(100, 108, 255, 0.1);
450+
}
451+
452+
&:active {
453+
transform: translateY(0);
454+
}
455+
456+
&.active {
457+
border-color: var(--vp-c-brand-1);
458+
background: var(--vp-c-brand-1);
459+
color: white;
460+
font-weight: 600;
461+
box-shadow: 0 2px 12px rgba(100, 108, 255, 0.3);
462+
}
463+
}
464+
/* ===================================== */
465+
/* #endregion 内容宽度配置 */
466+
/* ===================================== */

.vitepress/components/Settings/Settings.vue

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,53 @@
4444
</div>
4545
</section>
4646

47+
<!-- 内容宽度配置 -->
48+
<section :class="$style.section">
49+
<div :class="$style.sectionHeader">
50+
<h2 :class="$style.sectionTitle">
51+
<span :class="$style.icon">📏</span>
52+
内容区宽度
53+
<span
54+
:class="$style.infoIcon"
55+
@mouseenter="showTooltip('contentWidth')"
56+
@mouseleave="hideTooltip"
57+
@click="toggleTooltip('contentWidth')"
58+
>ℹ️
59+
<span
60+
v-if="activeTooltip === 'contentWidth'"
61+
:class="$style.tooltip"
62+
>
63+
调整文章内容区域的最大宽度(全屏模式下不限制宽度)
64+
</span>
65+
</span>
66+
</h2>
67+
<span :class="$style.badge">{{ contentWidth }}</span>
68+
</div>
69+
70+
<div :class="$style.widthOptions">
71+
<button
72+
:class="[
73+
$style.widthBtn,
74+
contentWidth === '688px' ? $style.active : '',
75+
]"
76+
@click="setContentWidth('688px')"
77+
title="标准宽度 688px(VitePress 默认)"
78+
>
79+
标准 (688px)
80+
</button>
81+
<button
82+
:class="[
83+
$style.widthBtn,
84+
contentWidth === '755px' ? $style.active : '',
85+
]"
86+
@click="setContentWidth('755px')"
87+
title="较大宽度 755px(适合宽屏)"
88+
>
89+
较大 (755px)
90+
</button>
91+
</div>
92+
</section>
93+
4794
<!-- MarkMap 配置 -->
4895
<section :class="$style.section">
4996
<div :class="$style.sectionHeader">
@@ -152,6 +199,8 @@ import {
152199
MARKMAP_EXPAND_LEVEL_KEY,
153200
} from '../constants'
154201
202+
const CONTENT_WIDTH_KEY = 'tnotes-content-width'
203+
155204
// ===================================
156205
// #region 响应式数据
157206
// ===================================
@@ -161,6 +210,7 @@ const markmapTheme = ref('default')
161210
const originalMarkmapTheme = ref('default')
162211
const markmapExpandLevel = ref(5)
163212
const originalMarkmapExpandLevel = ref(5)
213+
const contentWidth = ref('688px')
164214
const showSuccessToast = ref(false)
165215
const activeTooltip = ref<string | null>(null)
166216
// #endregion
@@ -197,6 +247,10 @@ onMounted(() => {
197247
const savedLevel = localStorage.getItem(MARKMAP_EXPAND_LEVEL_KEY) || '5'
198248
markmapExpandLevel.value = parseInt(savedLevel)
199249
originalMarkmapExpandLevel.value = parseInt(savedLevel)
250+
251+
const savedWidth = localStorage.getItem(CONTENT_WIDTH_KEY) || '688px'
252+
contentWidth.value = savedWidth
253+
applyContentWidth()
200254
}
201255
})
202256
// #endregion
@@ -255,6 +309,22 @@ function hideTooltip() {
255309
function toggleTooltip(id: string) {
256310
activeTooltip.value = activeTooltip.value === id ? null : id
257311
}
312+
313+
// 应用内容宽度(通过 CSS 变量)
314+
function applyContentWidth() {
315+
if (typeof document === 'undefined') return
316+
document.documentElement.style.setProperty(
317+
'--tn-content-width',
318+
contentWidth.value
319+
)
320+
}
321+
322+
// 设置内容宽度
323+
function setContentWidth(width: string) {
324+
contentWidth.value = width
325+
localStorage.setItem(CONTENT_WIDTH_KEY, width)
326+
applyContentWidth()
327+
}
258328
// #endregion
259329
</script>
260330

.vitepress/config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
import { defineConfig } from 'vitepress'
1717
import { repoName } from '../.tnotes.json'
18-
import TN_HMR_Plugin from './plugins/hmr'
18+
// import TN_HMR_Plugin from './plugins/hmr' // 已废弃,改用 FileWatcherService
1919
import {
2020
IGNORE_LIST,
2121
GITHUB_PAGE_URL,
@@ -61,7 +61,7 @@ export default defineConfig({
6161
// clientFiles: ['./**/*.md'],
6262
// },
6363
},
64-
plugins: [TN_HMR_Plugin()],
64+
// plugins: [TN_HMR_Plugin()], // 已废弃,改用 FileWatcherService
6565
css: {
6666
preprocessorOptions: {
6767
scss: {

.vitepress/plugins/hmr.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
TNOTES_YUQUE_BASE_URL,
1212
EOL,
1313
repoName,
14-
} from '../tnotes/constants.js'
15-
import { createAddNumberToTitle, generateToc } from '../tnotes/utils'
14+
} from '../tnotes/config/constants.js'
15+
import { createAddNumberToTitle, generateToc } from '../tnotes/utils/index.js'
1616

1717
export default async function TN_HMR_Plugin() {
1818
return {

.vitepress/theme/custom.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ a {
1616
/* !!! 修复 Discussions 两个主题 noborder light、noborder dark 的边框渲染不完整的问题 */
1717
.VPDoc.has-aside .content-container {
1818
padding: 0 2px !important;
19+
max-width: var(--tn-content-width, 688px) !important;
1920
}
2021

2122
/* !!! markdown-it-task-lists css enhancement */
@@ -48,13 +49,18 @@ ul > li.task-list-item > ul {
4849
background-color: var(--vp-nav-bg-color) !important;
4950
}
5051

51-
/* 主体内容往左补齐,否则左边会留白 */
52+
/* 主体内容往左补齐,与导航栏标题左对齐 */
5253
.hide-sidebar .VPContent {
5354
margin-left: 0 !important;
54-
padding-left: 0 !important;
55+
padding-left: calc(
56+
(100vw - var(--vp-layout-max-width)) / 2
57+
) !important; /* 与导航栏标题左边距对齐 */
5558
}
5659
.hide-sidebar .VPDoc .content-container {
57-
max-width: calc(688px + var(--vp-sidebar-width)) !important;
60+
max-width: calc(
61+
var(--vp-sidebar-width) + var(--tn-content-width, 688px) +
62+
var(--vp-sidebar-width)
63+
) !important;
5864
}
5965

6066
/* content fullscreen toggle */
@@ -80,7 +86,7 @@ ul > li.task-list-item > ul {
8086
overflow: auto;
8187
}
8288

83-
/* 主体内容往左补齐,否则左边会留白 */
89+
/* 全屏模式下不限制最大宽度 */
8490
.content-fullscreen .VPDoc .content-container {
85-
max-width: calc(688px + var(--vp-sidebar-width)) !important;
91+
max-width: none !important;
8692
}

0 commit comments

Comments
 (0)