blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
7.06k stars 414 forks source link

"Burning out" dataviews #42

Open kevboh opened 3 years ago

kevboh commented 3 years ago

I've started using dataviews in my daily notes via the daily note template. One dataview I'm using lists all the notes I edit that day:

list from "some-folder"
where file.mtime.day = date({{date:YYYY-MM-DD}}).day and file.mtime.month = date({{date:YYYY-MM-DD}}).month and file.mtime.year = date({{date:YYYY-MM-DD}}).year 

That ends up inserted in my daily note as a dataview that matches any files edited today. It's very useful. However, if I edit a file after that day, the list stops showing it, even though I edited a file on that day. Because I'd love to have a history of the files I've worked on for any given day, I need some way to "burn out" a dataview—effectively replace its code fence with its markdown result.

I can see this being a button that appears on hovering the code fence when in preview mode, or even a command in the command palette that operates on the dataview under the cursor. Even better would be a way to bake this into the dataview so that it happens automatically after a certain threshold, e.g.

list from "some-folder"
where file.mtime.day = date({{date:YYYY-MM-DD}}).day and file.mtime.month = date({{date:YYYY-MM-DD}}).month and file.mtime.year = date({{date:YYYY-MM-DD}}).year
burnout after {{date:YYYY-MM-DD}}

but I have no idea if such a thing is technically feasible, as I haven't dug too deeply into Obsidian's internals. Either way, a way to go from a dataview query to its hardcoded result would be very useful to freeze documents in time.

blacksmithgu commented 3 years ago

It's doable, and I've had a few people ask about it for another application (Obsidian Publish). Will add support for it in an upcoming release (likely by having it replace or append the fully rendered HTML for tables, and Markdown for everything else).

kevboh commented 3 years ago

Sounds neat. Let me know how I can help, happy to dig into the code.

THeK3nger commented 3 years ago

I was writing a separate feature request but I think this fits what I'd like. I think the possibility to "permanently expand dataview's queries" in the markdown source it is useful in many scenarios.

  1. Not all dataview queries needs to be dynamically updated. Sometimes I just want to generate a list/table of notes on the fly. Like in kevboh use case.
  2. It will make dataview more in agreement with the philosophy of "everything is just markdown" and "future-proof". Users should not worry that in 10 years dataview will be not working/maintained anymore. In any moment I could "make permanent" any query.
  3. Better integrations with third party apps. For instance, I may use dataview to populate some tables (or whatever new amazing view we will have in the future), and then complete the editing of my work on Ulysses (or other editors). In this case, the ability to copy the "markdown version" of my query would be a must.

So, in short, I fully agree with the need of a feature like this.

(btw, just for completeness, this feature request may be related to #99)

kevboh commented 3 years ago

Yeah, I would love for this to exist—keep finding uses for it. @blacksmithgu if you have an idea of how it could trigger, I'd be happy to try and PR it myself—been meaning to dig into the codebase anyway…

blacksmithgu commented 3 years ago

This has been on my backlog for a while but I have never managed to get around to it yet - @kevboh if you find the time to take a look at it I'd be happy to help scope it and review it.

jpalharini commented 3 years ago

I'd love to have this feature and, if possible, be able to use it "automatically" when my notes are committed to Github.

ghost commented 3 years ago

As cool as this plugin is, it's not very helpful for me unless I can use it to publish results (unless there is a way to include rendering from dataview as part of the build step in a js based framework like nextjs/gatsby/sveltekit?)

pcuellar commented 3 years ago

@blacksmithgu @kevboh I'm about to release a large vault with several dataview queries that I'd love to include. Curious to hear if there's any progress on this feature. Thanks!

dylan-k commented 2 years ago

I would also like to voice support for dataview to have a "static output" option. This could be particularly useful for use within templates, where the dataview query could be run so that the note results with the output of the query within it. For some use cases (archival), it's in keeping with the spirit of markdown to have note contents that will be readable in any context, not just Obsidian/Dataview, for years to come. In any case, thank you for the incredibly useful tool you're providing for the community. It's extremely helpful.

blacksmithgu commented 2 years ago

I think you can combine Templater + DataviewJS to do queries and dynamically generate Markdown tables + lists for this, but first class support is definitely a good idea.

The ways I'm planning on this interaction being possible are via:

jimbrig commented 2 years ago

Any updates or workaround for this issue?

This is my current workflow:

Lists

Tables