Home

Awesome

Obsidian API

Type definitions for the latest Obsidian API.

Documentation

You can browse our Plugin API documentation at https://docs.obsidian.md/

For an example on how to create Obsidian plugins, use the template at https://github.com/obsidianmd/obsidian-sample-plugin

Issues and API requests

For issues with the API, or to make requests for new APIs, please go to our forum: https://forum.obsidian.md/c/developers-api/14

Plugin structure

manifest.json

main.js

App Architecture

The app is organized into a few major modules:
Additionally, by inheriting Plugin, you can:
Registering events

For registering events from any event interfaces, such as App and Workspace, please use this.registerEvent, which will automatically detach your event handler when your plugin unloads:

this.registerEvent(app.on('event-name', callback));

If you register DOM events for elements that persist on the page after your plugin unloads, such as window or document events, please use this.registerDomEvent:

this.registerDomEvent(element, 'click', callback);

If you use setInterval, please use this.registerInterval:

this.registerInterval(setInterval(callback, 1000));