notesy::preview

A plugin's own screens for notesy preview: a board full of sample tasks, a panel in a state that's hard to reach by hand. Its plugin.toml names each in [[previews]] (plugin.toml), and its script says what each shows. Needs nothing.

rustuse notesy::{preview, store, view, views};

pub fn ready() {
    let board = views::add("board", "Task board", |note| view::note(`${tasks().len()} tasks`));
    preview::on("board", || {
        store::set("tasks", ["Record the demo video", "Update the pricing page"]);
        board.open();
    });
}

fn tasks() {
    store::get("tasks").unwrap_or([])
}
Function What it does
preview::on(name, handler) What its preview name shows: handler() runs when notesy preview ID/NAME shows it, just after ready, and never otherwise. name has to be one its manifest names.
notesy preview ana.tasks/board --plugin .

shows it (--plugin . for one you're working on; an installed plugin's previews run by name alone), and notesy preview --list lists every plugin's with notesy's own screens. A preview is for the look only: the plugin runs over a few sample notes, keeps its data in a temporary folder and its secrets nowhere, so what handler sets up is gone when the window closes. The network, reading the clipboard and opening links are held back unless it's run with --trust (Making, packing and installing plugins).

Every page