Query entire vault for specified (tagged) blocks and aggregate them in a note

Hello, I am trying to generate a note where all the blocks containing a specified tag are embedded, just as one can find it in Roam, or as it is generated by the code block ‘’'task (sorry for the bad syntax) for all blocks tagged as “task”.

Problem is, I’m absolutely new to Obsidian, with almost no experience in coding (excepted a few courses 20 years ago…), and I even don’t know if there is some code that would give this result.

I found a few basic things like creating a query and embed the results in a note - but it generates an excerpt of the blocks I’m searching for, not the whole block. Expanding the context may not work very well, especially if there are a lot of results.

With a plug-in in beta called “Obsidian Query Control”, i’t seems possible to render the results as Markdown, with more context by default, but I don’t know how to get this result with a block code rather than a plug-in.
I’ve looked at Dataview, but I’m not sure it would work on blocks as it seems to work on files.

PS: English is not my mother-tongue so maybe I missed something in the Help files and the forum, and/or there are typos here… so thank you for your understanding :smile:

Doing ordinary search queries, like you wrote before, is an option, and it might be your best option currently. Either with or without the query control plugins.

Using dataview you’re not in general able to extract just a random block of text. It can extract either single list items or task items, but not a paragraph/block of text outside of those already mentioned.

However, using dataviewjs (aka javascript queries through the Dataview plugin) you’re able to read the various files in their entirety, and that would allow for block manipulation if you’re so inclined, but this will require some coding and knowledge of text manipulation.

Sometime in the future, when Datacore (the sequel of dataview :slight_smile: ) is released, you might be able to do block manipulation through that plugin, but I’m not sure what’s the status of this plugin, and when/if it’ll be relased into the public.

1 Like

Thank you for your answer! Sorry for this late reply, I thought I would receive a notification when someone posts a reply - I’m a real newbie and this was my first post (and my first reply lol).
I think the functionality I was searching for (or at least the closest) is the “Show backlinck in document”. Together with the Obsidian Query Control, which offers the options “Render Markdown” and “Show more context”, it’s quite close to what Roam looks like. The real difference is that one needs to open the link - in another view, tab or window in order to select the text, but it isn’t a big deal…
Happy to save $15 for a single function I was missing for my work with Obsidian! :stuck_out_tongue_winking_eye:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.