If I have a file that is structured as a set of headers, with notes under each heading (maybe those are dates, but potentially not), is there a way to extract the top N headings and the subsequent text to embed dynamically in another note? The idea is that I keep notes for a project in one file, but have a project dashboard file that concatenates information from various places. I would like a “Most Recent Notes” section that would include the most recent content from a specified note.
For example, if I have a “Project X Notes” file and a “Project X Dashboard” file, I would like to extract the first (or last) two headers (“#”) from “Project X Notes” and display the content beneath those headers in “Project X Dashboard”, so that I can see the most recent notes I have taken for that particular project.
Things I have tried
I’ve looked at dataview’s standard queries, dataviewjs queries, and several other plugins that seemed relevant based on the descriptions, but nothing seemed to obviously address the issue.
I think DataView can’t do it because it’s oriented around whole files and tasks, but my DataView knowledge is very limited.
Some rough workarounds:
Format the headings as task list items instead, and then maybe DataView can do it.
In the Notes file, put the headings under Recent and Older headings. (This requires manually moving the bottom Recent into Older when you add a new Recent.)
In the Notes file put the recent headings in a callout. (Requires manually moving the bottom one out of the callout when you add a new one, and might affect the Outline tab.
and the structure of the file it is querying (with bogus content for now)
---
name: Project 0
type: notes
---
# 2023-10-08
- Project 0 is at risk of falling behind. Need more resources
# 2023-10-16
- Now we need to test the most recent changes
# 2023-10-17
- Most recent changes were successful
I see that it correctly extracts the last two headers from the file, but when I specify embed=true all I see is Notes > 2023-10-16 and Notes > 2023-10-17. If I make embed=false, it correctly shows a link to the correct places, but the embed isn’t working. I suspect it might be the dv.paragraph(), but I’m not 100% sure.
I ended up going with a different approach to get this done. I used the plugin Meld Build instead. Using the same input file as above, I can include the following codeblock in another file. The only downside is that I have not found out an easy way to automatically update this when I open the file, but having to hit a button isn’t that bad.