How to insert views from template in reading mode?

Hello,

First, I would like to thank you for Obsidian, such a great note maker ; I really love it.
I would like to know how to insert views (or more precisely dataviews) in reading mode from a markdown template.

For example, I have the following template to show relatives sources for a resource in a table :

TABLE title as "Title", type as "Type"
FROM "Sources"
WHERE type = "source" AND contains(this.sources, title)

I would like to see the result of the dataview for the current resource when I am in reading mode.

I dont want to use templater to insert this code in any of my resource notes ; it would be difficult to maintain and a waste of space.

I though to make a plugin, but I don’t get when I have to insert the template in the markdown view.

Thanks a lot

If you don’t want to “insert” any code in the note where you want to see the dynamic results of dataview query (mainly when your query point to the current file), I guess you need to create a specific plugin to do that.

Without a specific plugin, I guess you need to use some code. It may not be that code, but it must be any that points to it. For example, I never explore to much the dv.view() function (docs), but you can create a js file with a recurrent query and reuse it in any file with dv.view() .

Thanks for your answer.
I will create a plugin ; I firstly thought that
this.app.workspace.getActiveViewOfType(MarkdownView).data
was unmodifiable, but no. So I can do whatever I want :slight_smile: