遇到的问题
在一个示例库(抱歉不记得原地址了)扒了一串搜索并列出关键词的代码:
let folderChoicePath = "(笔记位置)"
const files = app.vault.getMarkdownFiles().filter(file => file.path.includes(folderChoicePath))
let arr = files.map(async(file) => {
const content = await app.vault.cachedRead(file)
let lines = await content.split("\n").filter(line => line.includes("(关键词)"))
//console.log(lines)
return ["[["+file.name.split(".")[0]+"]]", lines]
})
Promise.all(arr).then(values => {
const beautify = values.map(value => {
const temp = value[1].map(line => { return line })
return [value[0],temp]
})
const exists = beautify.filter(value => value[1][0] && value[0] != "[[未命名 10]]") .sort(value => value[0],'desc')
dv.table(["日期", "记录内容"], exists)
})
然后在实际使用过程中,因为一句文字太长了,没有办法显示完全,像这样:
预期的效果
希望能显示完全。