mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
536 stars 43 forks source link

Unclear on the use of `hidden` View Field Argument with arguments #442

Closed Krustal closed 1 month ago

Krustal commented 1 month ago

Page

https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/reference/viewfieldarguments/hidden/

Issue or Enhancement

The basic usage of hidden is clear but I would expect, given the hidden(value: true | false) field documentation that we could do something like:

VIEW[+1 for modifying effect][text(hidden({modifyEffect}))]

And it would only show the field if the true/false property was true. This doesn't appear to be the case however. If you can only use hidden with true/false literals then I'm not clear on the use case.

mProjectsCode commented 1 month ago

This doesn't appear to be the case however.

Correct.

If you can only use hidden with true/false literals then I'm not clear on the use case.

The docs give a use case: "This can be useful if you want the view field to compute an intermediate value and write that value to the frontmatter." Maybe I should add to the sentence ", but you don't want to see the value somewhere in your note."

Krustal commented 1 month ago

So in what case would you use:

VIEW[+1 for modifying effect][text(hidden(false))]

Is the fact you can pass a value just a side effect of the way the parser operates?

EDIT: I think I realized the use case if you are using meta-bind-js-view you could interpolate a boolean into the output. So I could get the effect I imagine that route.

```meta-bind-js-view
{modifyEffect} as modifyEffect
---
return engine.markdown.create(`VIEW[+1 for modifying effect][text(hidden(${context.bound.modifyEffect}))]`