Files
plainleaf/website/API/slashCommand.md
T
Zef Hemel 26d9d5bdf0 Restructure standard library and improve documentation
Refactor Library/Std into subfolders for APIs, Infrastructure, Editor,
Widgets, etc. Add more documentation and descriptions. Update references
throughout website and docs.
2025-10-01 11:22:31 +02:00

24 lines
531 B
Markdown

APIs to create [[Slash Commands]]. For simple cases it is recommended to use [[Library/Std/Infrastructure/Slash Templates]] instead.
## slashCommand.define(spec)
Define a custom slash command.
Supported keys in the spec:
* `name`: name of the command
* `description`: Description of the command
* `run`: The callback function that will be invoked once the command is run.
Example:
```lua
slashCommand.define {
name = "hello-world",
run = function()
editor.insertAtCursor("Hello |^| world!", false, true)
end
}
```