Thanks @AlanG – This is a gift that keeps on giving. Just started working with it and it works like a charm.
One question, in the YMAL header, I set a datapoint to distinguish between the kind of notes e.g. “type: morning journal”, “type: evening journal”. Do you know how I can include this into the data view query to be independent of my folder structure?
Version returning the table instead of paragraphs. Thanks @dustin
const header = '#+ [^\\n]*?Tester[^\\n]*?'
// You can update this to filter as you like - filtering for just your daily notes would be good
const pages = dv.pages('#daily').sort(x => x.file.name, 'desc')
// This regex will return text from the Summary header, until it reaches
// the next header, a horizontal line, or the end of the file
const regex = new RegExp(`\n${header}\r?\n(.*?)(\n#+ |\n---|$)`, 'is')
const summaries = []
for (const page of pages) {
const file = app.vault.getAbstractFileByPath(page.file.path)
// Read the file contents
const contents = await app.vault.read(file)
// Extract the summary via regex
const summary = contents.match(regex)
if (summary && summary[1].trim()) {
summaries.push([`[[${file.basename}]]`, summary[1].trim()]);
}
}
dv.table(["Note", "Description"], summaries)