datacore icon indicating copy to clipboard operation
datacore copied to clipboard

[FEATURE REQUEST] Inline views like Dataview

Open ShadiestGoat opened this issue 6 months ago • 3 comments

I use `= this.x` syntax quite often with dataview. It'd be nice for datacore to support this as well

ShadiestGoat avatar Jun 11 '25 19:06 ShadiestGoat

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

techy-robot avatar Jun 25 '25 20:06 techy-robot

I also vote for shorthand queries.

In the meantime, I tried some workarounds.

  1. 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.

sergeict avatar Jul 28 '25 12:07 sergeict

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.

HatfieldS avatar Sep 21 '25 00:09 HatfieldS