A snippet for a function

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(“|^|”)}}

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.

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”)}}
```

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.