Check whether the target version key already exists in versions.json instead of whether the minAppVersion value exists. The old check incorrectly skipped writing a new entry when a prior version mapped to the same minAppVersion. Modernize TypeScript and esbuild configuration - Set target to ES2021 (Obsidian runs on modern Electron/Chromium) - Replace individual strict flags with strict: true - Update lib to ES2021 + DOM - Remove importHelpers and allowJs - Add skipLibCheck, forceConsistentCasingInFileNames, noFallthroughCasesInSwitch - Align esbuild target to es2021 Update dependencies - Bump @types/node from ^16.11.6 to ^22.15.17 (Node 16 is EOL) - Bump eslint-plugin-obsidianmd from 0.1.9 to 0.2.4 - Bump globals from 14.0.0 to 16.1.0 - Bump typescript-eslint from 8.35.1 to 8.32.1 - Remove tslib (no longer needed without importHelpers) Fix code issues and update minimum app version - Prefix unused parameters with _ (evt, view) - Use definite assignment assertion on settings property - Fix editorCallback parameter type (MarkdownView | MarkdownFileInfo) - Replace document/window with activeDocument/activeWindow - Replace let with const in SampleModal.onOpen - Bump minAppVersion from 0.15.0 to 1.0.0 - Update eslint config for obsidianmd plugin 0.2.4 compatibility Update documentation - Fix entry point references (main.ts -> src/main.ts) - Update minimum Node.js version to v18 - Replace outdated eslint instructions with npm run lint - Update code examples for strict mode and activeWindow - Remove yarn as alternative to npm Update eslint configuration Bump to eslint 10 Return to eslint 9 chore: formatting feat: add release CI chore: bumped obsidian eslint plugin to latest version chore: cleanup redundant code chore: moved obsidian to devDependencies fix: apply ignore patterns before rulesets docs: updated AGENTS.md to match codebase fix: set quote_style to single chore: formatting
Obsidian Sample Plugin
This is a sample plugin for Obsidian (https://obsidian.md).
This project uses TypeScript to provide type checking and documentation. The repo depends on the latest plugin API (obsidian.d.ts) in TypeScript Definition format, which contains TSDoc comments describing what it does.
This sample plugin demonstrates some of the basic functionality the plugin API can do.
- Adds a ribbon icon, which shows a Notice when clicked.
- Adds a command "Open modal (simple)" which opens a Modal.
- Adds a plugin setting tab to the settings page.
- Registers a global click event and outputs a Notice on click.
- Registers a global interval which logs 'setInterval' to the console.
First time developing plugins?
Quick starting guide for new plugin devs:
- Check if someone already developed a plugin for what you want! There might be an existing plugin similar enough that you can partner up with.
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it).
- Clone your repo to a local development folder. For convenience, you can place this folder in your
.obsidian/plugins/your-plugin-namefolder. - Install NodeJS, then run
npm iin the command line under your repo folder. - Run
npm run devto compile your plugin fromsrc/main.tstomain.js. - Make changes to
src/main.ts(or create new.tsfiles). Those changes should be automatically compiled intomain.js. - Reload Obsidian to load the new version of your plugin.
- Enable plugin in settings window.
- For updates to the Obsidian API run
npm updatein the command line under your repo folder.
Releasing new releases
- Update your
manifest.jsonwith your new version number, such as1.0.1, and the minimum Obsidian version required for your latest release. - Update your
versions.jsonfile with"new-plugin-version": "minimum-obsidian-version"so older versions of Obsidian can download an older version of your plugin that's compatible. - Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix
v. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases - Upload the files
manifest.json,main.js,styles.cssas binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release. - Publish the release.
You can simplify the version bump process by running
npm version patch,npm version minorornpm version majorafter updatingminAppVersionmanually inmanifest.json. The command will bump version inmanifest.jsonandpackage.json, and add the entry for the new version toversions.json
Adding your plugin to the community plugin list
- Check the plugin guidelines.
- Publish an initial version.
- Make sure you have a
README.mdfile in the root of your repo. - Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin.
How to use
- Clone this repo.
- Make sure your NodeJS is at least v18 (
node --version). npm ito install dependencies.npm run devto start compilation in watch mode.
Manually installing the plugin
- Copy over
main.js,styles.css,manifest.jsonto your vaultVaultFolder/.obsidian/plugins/your-plugin-id/.
Improve code quality with eslint
- ESLint is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
- This project already has eslint preconfigured, you can invoke a check by running
npm run lint - Together with a custom eslint plugin for Obsidan specific code guidelines.
- A GitHub action is preconfigured to automatically lint every commit on all branches.
Funding URL
You can include funding URLs where people who use your plugin can financially support it.
The simple way is to set the fundingUrl field to your link in your manifest.json file:
{
"fundingUrl": "https://buymeacoffee.com"
}
If you have multiple URLs, you can also do:
{
"fundingUrl": {
"Buy Me a Coffee": "https://buymeacoffee.com",
"GitHub Sponsor": "https://github.com/sponsors",
"Patreon": "https://www.patreon.com/"
}
}