1
0

fix: 优化思源笔记转换脚本,处理特殊符号

This commit is contained in:
2025-10-09 13:34:06 +08:00
parent 9f34c06683
commit 012865cfbb

View File

@@ -13,6 +13,7 @@ function markdownTableToJson(markdownTable = '') {
return line return line
.replace(/^\||\|$/g, '') // 移除首尾的管道符号 .replace(/^\||\|$/g, '') // 移除首尾的管道符号
.replace(/\\/g, '') // 移除转义符号 .replace(/\\/g, '') // 移除转义符号
.replace(/<br\/>/g, '') // 移除换行标签
.split('|') .split('|')
.map(cell => cell.trim()); .map(cell => cell.trim());
}; };
@@ -86,7 +87,7 @@ function markdownTableToJson(markdownTable = '') {
for (let i = indexJson.length - 1; i >= 0; i--) { for (let i = indexJson.length - 1; i >= 0; i--) {
let item = indexJson[i]; let item = indexJson[i];
let oldName = (item['title'] + '.md').replace(/"/g, '_'); let oldName = (item['title'] + '.md').replace(/("|:)/g, '_');
let oldPath = join(markdownDir, oldName); let oldPath = join(markdownDir, oldName);
let newName = item['slug'] + '.md'; let newName = item['slug'] + '.md';
let newPath = join(markdownDir, newName); let newPath = join(markdownDir, newName);