[FEATURE REQUEST] Inline views like Dataview
I use `= this.x` syntax quite often with dataview. It'd be nice for datacore to support this as well
I see this as being very useful, I think that part of it could be implemented using an implicit return function View()
For example, here is my shortest datacorejsx snippet to pull outlinks.
return function View() {
return <dc.List rows={dc.useCurrentFile().$links} paging={15}/>;
}
If there was an inline syntax with implicit return, it could be something like:
`= <dc.List rows={dc.useCurrentFile().$links}/>`
Then we could figure out if any other short codes are needed
I also vote for shorthand queries.
In the meantime, I tried some workarounds.
- Note that for DataCore 1.024 (Obsidian 1.8.10 on Windows10, just Brat and Datacore plugins, dc.useCurrentFile() does not work ( returns null ) while dc.useCurrentPath and dc.CurrentFile() do their job. I currently use dc.currentFile in my jsx scripts withouut issue.
For simple text fields, I use a simpler query, to allow direct formating, such as :
return function View(){
return <span>{dc.currentFile().value("--fn--)}</span>;
}
where --fn-- has to be replaced with your field name. It is not a full replacement, tough : jsx appends a newline before and after the rendered block, which is not the case with inline dtaview.
Hence, the sentence "Here is my field value, embedded in a sentence" becomes "Here is my field value ,embedded in a sentence"
Not very practical. Maybe it would be easy to fix or add as a rendering option ( newline before / after the brendered block)
But since DataCore supports kind of data that DataView does not, default rendering using a shorthand can be more challenging. Definitely, I would welcome a solution for the kind of fields we commonly use in a text flow or quick table : text, number, tick box/boolean, date, date & time.
A set of shortcodes, or better, a way to create them is also appealing.
DataCore is very promising and could be a foundation for something great. I hope to see the first official release soon.
Having an inline query function like Dataview would be amazing. Especially if there's also a way to "freeze" the output so that it's publish-friendly.