Vandrite Docs

Plugin Development

Build custom plugins to extend Vandrite's functionality

Plugin Development

Welcome to the Vandrite Plugin Development Guide! This section covers everything you need to know to build powerful plugins for Vandrite.

Overview

Vandrite plugins are TypeScript/JavaScript modules that extend the app's functionality. With the Plugin API, you can:

  • Add custom commands to the command palette
  • Listen to and respond to events
  • Interact with files in the vault
  • Create custom UI modals
  • Register keyboard shortcuts
  • Manipulate the editor content
  • Access theme settings

Quick Start

Get started building your first plugin in just a few steps:

Installation

npm install @vandrite/plugin-api

Basic Example

import { Plugin } from "@vandrite/plugin-api";

export default class MyPlugin extends Plugin {
  async onload() {
    console.log("Plugin loaded!");

    this.addCommand({
      id: "my-command",
      name: "Say Hello",
      callback: () => {
        this.app.events.trigger("notice", "Hello from my plugin!");
      },
    });
  }

  onunload() {
    console.log("Plugin unloaded!");
  }
}

API Categories

APIDescription
app.commandsRegister and execute commands
app.eventsSubscribe to application events
app.vaultAccess files in the vault
app.modalsShow dialogs and prompts
app.hotkeysRegister keyboard shortcuts
app.editorInteract with the text editor
app.themeAccess and modify themes

Resources

On this page