Type definitions for the latest Obsidian API.
Warning: The Obsidian API is still in early alpha and is subject to change at any time!
All API documentation is located in the file
This will include types, properties, methods and comments explaining what everything does.
For a full example on how to create Obsidian plugins, use the template at https://github.com/obsidianmd/obsidian-sample-plugin
idthe ID of your plugin.
namethe display name of your plugin.
authorthe plugin author's name.
versionthe version of your plugin.
minAppVersionthe minimum required Obsidian version for your plugin.
descriptionthe long description of your plugin.
authorUrl(optional) a URL to your own website.
isDesktopOnlywhether your plugin uses NodeJS or Electron APIs.
- This is the main entry point of your plugin.
- Import any Obsidian API using
- Import NodeJS or Electron API using
- Must export a default class which extends
The app is organized into a few major modules:
App, the global object that owns everything else. You can access this via
this.appinside your plugin. The
Appinterface provides accessors for the following interfaces.
Vault, the interface that lets you interact with files and folders in the vault.
Workspace, the interface that lets you interact with panes on the screen.
MetadataCache, the interface that contains cached metadata about each markdown file, including headings, links, embeds, tags, and blocks.
Additionally, by inheriting
Plugin, you can:
- Add a ribbon icon using
- Add a status bar (bottom) element using
- Add a global command, optionally with a default hotkey, using
- Add a plugin settings tab using
- Register a new kind of view using
- Save and load plugin data using
For registering events from any event interfaces, such as
Workspace, please use
this.registerEvent, which will automatically detach your event handler when your plugin unloads:
If you register DOM events for elements that persist on the page after your plugin unloads, such as
document events, please use
this.registerDomEvent(element, 'click', callback);
If you use
setInterval, please use