I tried to make a as-simple-as-possible-but-no-simpler set of instructions for getting started with plugins. (The idea here is to give you everything you need to be able to do things with plugin development, and nothing more than that.)
A rough guide on getting started fiddling with plugins
- Download VS Code
- Set up Node.js and NPM
- Find a simple plugin on GitHub (the sample plugin is a potential one, but it doesn’t really do anything—maybe look for something that provides functionality similar to what you’d like to build)
- Download the plugin into a folder on your desktop by cloning it
- Compile the downloaded plugin code
- Open your terminal
- Open the folder for the newly-downloaded plugin in the terminal (If you need help with the terminal, search the web for advice for your platform—the exact commands can be different depending on whether you’re using macOS/Windows/Linux/etc.
- Run
npm i
in the plugin folder - Run
npm run dev
and the terminal will re-compile whenever the .ts file has changes saved
- Open up the plugin’s folder in VS Code
- Open the file
main.ts
and start changing things - Refer to the Obsidian API to understand what you can use
- In VS Code, you can hover over/select API elements and look up their definitions
- Use
console.log(object)
orconsole.log(variable)
to check the state/functioning of your plugin (see debugging below) - Drag the newly-created
main.js
andmanifest.json
files from the plugin folder intoYour-Vault/.obsidian/plugins/Some-Plugin-Folder
- (If loading the plugin for the first time, reload—or quit and relaunch—Obsidian)
- (Unload and re)load the plugin in Obsidian’s Preferences → Community Plugins → the appropriate plugin toggle
- Test it by invoking the features you’ve played with
- Debug by using the Console tab in Obsidian’s Developer Tools (open dev tools with cmd/ctrl+shift+i, then select the console tab)