Open Gnopps opened 3 years ago
It would probably be a different view (maybe a list view, or a 'transcude view?'), but yes, definitely possible.
I'm very interested in this as it would replace a chunk of my workflow I've written some custom code for. It looks like the infrastructure is there based off what I see in this function: https://github.com/blacksmithgu/obsidian-dataview/blob/067ca4d5faffb83c6e5558df9ba3ddf6efca438a/src/data/value.ts#L75
I might take a stab at implementing this if I find the time.
Hi,
This is exactly what I am looking for, as a replacement for 'Text Expander' (since the CM6 move broke it)
Has there been any activity on reaching this goal?
Thanks Mark
Could you explain how this is related to text expander?
Could you explain how this is related to text expander?
I currently use text expander to transclude a list of files. DV can provide the list of links, but not the β!β to transclude them.
Oh yeah, hmm. I imagine this is doable in DVJS though. Could also hook it up to templater to provide the list at runtime but it's quite hacky IMO.
If you could point me in right direction... π
Haven't figured out how to change the output formatting of DVJS π
The general idea is that you could find the files you need with some DVJS and then output or append them to current file with Obsidian's API. For example:
let tfile = app.vault.getAbstractFileByPath("path/to/file");
let output = dv.pages("#test").file.name.map(t=>`![[${t}]]`).join("\n");
await app.vault.append(tfile, output);
Above kept erroring, so worked and got this
dv.list(
dv.pages('"Diary" AND #test')
.file.name
.map(t=>`![[${t}]]`));
which does transclude the first file, but then rest just show as file names. Tried it using file.link and !${t}, with same result π
This works!
dv.list(
dv.pages('"Diary" AND #test')
.forEach(p => dv.paragraph(dv.fileLink(p.file.name, true)))
);
I've created a slightly different workaround using dataviewjs. See the last line in the code below.
let meetings = dv.current().file.inlinks
meetings = meetings.sort(k => dv.page(k).date, 'desc')
for (let meeting of meetings){
if (dv.page(meeting).file.tags.indexOf("#meeting")>-1){
dv.el("p", "![[" + dv.page(meeting).file.name + "]]");}
}
Embed links seem to situationally work, and I've had better luck with them in DataviewJS than in Dataview for whatever reason.
Hello, this still seems to be completely hit-or-miss for me after trying all the above methods (and playing around with dv.sectionLink
and dv.fileLink
with embed=true
). I don't know if it's because of the live editor, but the embeds just seem to show the file name in plain text (not even as a link)
What's your use case?
Nothing has really changed Obsidian-side w.r.t. being able to do embeds; there isn't much I can do in Dataview aside from manually trying to re-implement some common use cases like image embedding (via embed(link(...))
).
I found a good example of this over in SRS. Happy to help anyone walk through implementing that but I expect it won't work with live preview.
Hi, Yes, please, would love to see how this can be done.
PS: No idea what SRS is? π
I've seen a transclusion implementation here: https://github.com/st3v3nmw/obsidian-spaced-repetition/blob/80af505c082495e1956ca5aad11ddbe90c495af3/src/flashcard-modal.tsx#L418
My use case is this:
![[2022-09-17 pamela paul - when diversity isnt the right kind of diversity#^d88bdc]]
, which resolves in the kanban and markdown views.I can click through on a task which takes me to the kanban task. Fine. And it is resolved there. But what might be best would be a dataview directive to same 'please resolve transclusions in the results'.
I've seen a transclusion implementation here: https://github.com/st3v3nmw/obsidian-spaced-repetition/blob/80af505c082495e1956ca5aad11ddbe90c495af3/src/flashcard-modal.tsx#L418
I guess I can just steal this embedding magic wholesale inside the Dataview renderMarkdown
function.
I really wish Obsidian included a cleaner way of rendering embeds but this works for now. It took me quite a while to understand what was happening there haha.
ooo, is it ready for testing?
No, not yet. Keep an eye on the releases for updates.
Thanks for developing this plugin!
Would it be possible to have the results published transcluded? So instead of the list produced being
[[File_name]]
it would be![[File_name]]
.?