Text plugin

Text plugins deal with custom TeX-like commands.

Register commands

Here we will register a command \hello and call it in the config file. You also need plugin_type to specify that it is a text plugin.

use ayaka_bindings::*;

#[export]
fn plugin_type() -> PluginType {
    PluginType::builder().text(["hello"]).build()
}

#[export]
fn hello(_args: Vec<String>, _ctx: TextProcessContext) -> TextProcessResult {
    let mut res = TextProcessResult::default();
    res.line.push_back_chars("Hello");
    res
}

Call the command in the config file:

- \hello world!

And it outputs:

Hello world!

The process results

The TextProcessResult object is some lines and properties to be added to the current action. line will be appended to the current position of the command, and props will be set and update.

Existing plugins

PluginDescription
basictexBasic TeX commands.
live2dLive2D commands.