fix: 优化思源笔记转换脚本,只获取表格中指定的字段
This commit is contained in:
@@ -44,17 +44,22 @@ function markdownTableToJson(markdownTable = '') {
|
|||||||
let jsonArray = dataRows.map(row => {
|
let jsonArray = dataRows.map(row => {
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
'created-at': '',
|
|
||||||
'is-hide': '',
|
|
||||||
'slug': '',
|
|
||||||
'title': '',
|
'title': '',
|
||||||
|
'slug': '',
|
||||||
|
'created-at': '',
|
||||||
'updated-at': '',
|
'updated-at': '',
|
||||||
|
'is-hide': '',
|
||||||
};
|
};
|
||||||
|
|
||||||
headers.forEach((header, index) => {
|
headers.forEach((header, index) => {
|
||||||
|
|
||||||
let key = header.trim();
|
let key = header.trim();
|
||||||
let text = row[index];
|
let text = row[index];
|
||||||
obj[key] = text ? text.trim() : '';
|
|
||||||
|
if (typeof obj[key] !== 'undefined') {
|
||||||
|
obj[key] = text ? text.trim() : '';
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
Reference in New Issue
Block a user