fix: 移除标题伪元素#前缀并修正目录层级

- 删除 custom.css 中给 h1/h2/h3 强加 # 前缀的 ::before 规则
- 将 X.Y 子节标题由 ## 提升为 ###,使 TOC 正确嵌套
- 新增 tools/fix-headings.js 用于批量调整标题层级
This commit is contained in:
2026-07-08 22:03:01 +08:00
parent b3f44d235a
commit e7de4af00b
3 changed files with 66 additions and 52 deletions
+14
View File
@@ -0,0 +1,14 @@
// 将文章中的子节标题(X.Y 形式、拣选提交)从 ## 提升为 ###,使目录正确嵌套
const fs = require('fs');
const p = 'c:/Users/Administrator/Desktop/新建文件夹/blog/source/_posts/Git使用教学.md';
let s = fs.readFileSync(p, 'utf8');
const n1 = (s.match(/^## \d+\.\d+、/gm) || []).length;
s = s.replace(/^## (\d+\.\d+、)/gm, '### $1');
const n2 = (s.match(/^## 拣选提交/gm) || []).length;
s = s.replace(/^## (拣选提交)/gm, '### $1');
fs.writeFileSync(p, s);
console.log('提升 X.Y 子节: ' + n1 + ' 处');
console.log('提升 拣选提交: ' + n2 + ' 处');