I’ve looked through many CSS snippets and plugins and could’t find anything that provides the functionality I seek.
What I’m trying to do
I want to style an embedded query so that it looks (and behaves) like a series of embedded blocks. For example, let’s say I have an #example tag that appears in 2 different notes/blocks: Note 1#^1a234b and Note 2#^5c678d. I would like to embed the following search:
and style the results so that it looks like I had written:
I would prefer to use an embedded query for this over dataview because, even if dataview could retrieve an entire block, I wouldn’t be able to click on the block to open/edit the note of origin in a new window.
Is this possible? Or is there a workaround that would give me similar results?
There are many thing which might go wrong in this seemingly simple scenario:
It’s in no way given that the search for a tag results in a block which is properly tagged with a blockId. Most likely, it’s not tagged
The query search will only list the filename, not an embedded version of the search
Using dataview, as you’ve stated, even if the two above weren’t an issue, is somewhat faulty when it comes to embedding
Can these issues be countered? Not easily. The last one regarding dataview and embedding can be handled by using a combination of Templater and dataview, but it’ll not handle the limit to only embed the block. It’ll most likely embed the entire note.
There are three ways I can this coming to life:
Change so that the entire block is an inline field, and can be lifted out using field searches, and not embedding
Change syntax to list syntax, so that we can access the lists using dataview (and potentially Templater (or QuickAdd ?)), and produce the embed links with blockIds
Manually scanning files with the given tag, and pull out sections having blockIds, to then produce the links
Given a change in format to list format, then a query similar to the following could be used. Just a mockup of the embed link is produced in this example, and I’m using #f53209 as the tag:
LIST WITHOUT ID "" + file.name + "#^" + item.blockId + ""
FLATTEN file.lists as item
WHERE contains(item.tags, "53209") AND item.blockId
In my test setup I’ve got four references to the #53209, but only two of them are within a list item with a blockId, so my output became:
I’ve not written up any examples of the two other methods, but they’re doable, albeit with some work to get them working.