// 将文章中的子节标题（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 + ' 处');
