obsidian-meta-bind-plugin
obsidian-meta-bind-plugin copied to clipboard
Button template varaibles
Is your Feature Request Related to a Problem?
Button templates are not flexible enough
Describe the Feature you'd Like
I would like to be able to pass arguments to my button templates.
Additional Context
I have buttons on my daily notes to go to the next and previous notes. Unfortunately I can't create a template for them because the note paths change every day. It would be amazing to be able to pass arguments/overrides to the button template (similar to input overrides).
PS: Love your plugin, great job! Thank you for your work.
I don't think this is feasible. How would I cram overrides for a complex object into an inline button?
Would placeholders be possible?
Something like this:
# Template:
```meta-bind-button
label: Previous
icon: move-left
hidden: true
class: ""
tooltip: ""
id: previous
style: primary
actions:
- type: open
link: "%placeholder"
```
# Button
`BUTTON[previous[placeholder]]`
I am also stuck behind this feature. Currently trying to add buttons to a table dynamically made via dataviewj. That when clicked append to a yaml frontmatter list. As far as I can tell there is no way to pass separate data to each button. I am able store the data via a set of hidden inputs with memory scope bind targets. But there is no way to have each button reference them. Even just the ability to pass some inline java script to the template would be enough of a work around.
// dataviewjs block
const mb = app.plugins.plugins["obsidian-meta-bind-plugin"].api
var bindTarget = mb.parseBindTarget("Spells", dv.current().file.path)
console.log(mb.getMetadata(bindTarget))
var buttonTemp = "" //template with variable
const playerTags = dv.current().tags
const spells = dv.pages('"3-Mechanics/CLI/spells"')
.where(s => s.tags && s.tags.contains("spell/level/1") && s.tags.contains("spell/class/wizard"))
const markdown = dv.markdownTable(["Spell", "Link", "Tags", "Button"],
spells.map((b, index) => [
"`INPUT[toggle(class('custom_hide_class'), offValue({1}), onValue({1}), defaultValue({1}), showcase(true)):addSpell{0}]`{1}".format(index, b.file.name),
b.file.link,
b.tags.filter(tag => playerTags.includes(tag)),
buttonTemp
])
)
dv.paragraph(markdown)
Really hoping for this because it would enable so much.
Same here. I've tried adding inline buttons from a template in a similar way (see below) and would love to see this implemented. Any ideas on my end are very welcome :)
//meta-bind
INPUT[number(
title(<%_ field1 _%>)): <%_ field1 _%>
]
INPUT[number(
title(<%_ field2 _%>)): <%_ field2 _%>
]
INPUT[number(
title(<%_ field3 _%>)): <%_ field3 _%>
]