duarch
(Andre Duarch)
February 4, 2025, 12:05am
1
How can I set this snippet so it can let user input just after complete /mything ?
As myfunction expects a string it is always returning an error since it interprets “|^|” as a parameter
---
tags: template
hooks.snippet:
slashCommand: "mything"
exceptContexts:
- FencedCode
---
```template
{{myfunction(“|^|”)}}
bent0n
February 4, 2025, 7:28pm
2
You remove the input from the function and then ask for user input in the first step of your function.
silverbullet.registerFunction({name: 'myfunction '}, (string) => {
input = editor.prompt("Enter input:", "Name");
})
Idea stolen from here . Not the most elegant solution but it should work.
duarch
(Andre Duarch)
February 4, 2025, 11:57pm
3
Thanks for the suggestion, but it didn’t work. I tried it, but the input didn’t appear. I’d also like to put the cursor inside the (|^|), which would be awesome.
I wish we could pass parameters inline, e.g.:
params /myfunction
Which would then be wrapped as:
```template
{{myfunction(“params”)}}
```
bent0n
February 5, 2025, 8:12am
4
For this maybe look at space-lua . It lets you use functions inline and renders the results directly.
So you could do {{myfunction(parameter)}}
directly inside your pages.
For now, it’s only available on edge.