udus12210k downloadsOutput markdown from your Dataview queries and keep them up to date. You can also publish them.
Output markdown from your Dataview queries and keep them up to date. You can also be able to publish them.

This plugin uses the following two plugins, so you must install them:
Settings -> Community PluginsSettings -> Obsidian 42 - BRAT)Beta Plugin List sectionAdd Beta Pluginudus122/dataview-publisherCheckbox Time Tracker plugin (Settings -> Community Plugins)%% DATAVIEW_PUBLISHER: start
```dataview
<Your favorite Dataview query>
```
%%
<Query results will be output as markdown here>
%% DATAVIEW_PUBLISHER: end %%
Tips: To suppress the original rendering, omit "dataview" of info string.
Display a list of files tagged with #articles
There are two notes tagged with #articles in the Vault (Article1.md, Article2.md).
%% DATAVIEW_PUBLISHER: start
```dataview
LIST FROM #articles SORT file.name
```
%%
- [[Article1.md|Article1]]
- [[Article2.md|Article2]]
%% DATAVIEW_PUBLISHER: end %%
For detailed instructions on how to write DQL, please refer to the Dataview documentation.
Dataview can also output the results of executing arbitrary JavaScript code by setting the code block language (info string) to javascript, js, or dataviewjs.
This allows you to output Markdown strings in the desired format by using Dataview's Markdown functions.
%% DATAVIEW_PUBLISHER: start
```dataviewjs
const articles = dv.pages("#articles").map(article => `[[${article.file.name}]]`);
`
## Articles
${dv.markdownList(articles)}
`;
```
%%
## Articles
- [[Article1]]
- [[Article2]]
%% DATAVIEW_PUBLISHER: end %%
Dataview JS is executed using the eval() function. the last expression or value evaluated is output (Leading and trailing whitespace and newlines will be trimmed).
It doesn't render HTML, so it won't be output even if you use the Dataview's Render functions. Please output a Markdown string as the last expression or value.
You can use DataviewAPI object as dv and TFile object of current file as file.
Warning: It can be dangerous to execute arbitrary codes from untrusted sources. Only run codes that you understand, from trusted sources.


This plugin highly inspired by this article.