{"id":14070255,"url":"https://github.com/mnowotnik/obsidian-user-plugins","last_synced_at":"2026-04-02T14:55:52.885Z","repository":{"id":86163795,"uuid":"488729461","full_name":"mnowotnik/obsidian-user-plugins","owner":"mnowotnik","description":"Allows user scripts to use plugin API","archived":false,"fork":false,"pushed_at":"2024-11-16T14:59:19.000Z","size":108,"stargazers_count":79,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-30T07:51:18.092Z","etag":null,"topics":["javascript","obsidian","obsidian-md","obsidian-notes","obsidian-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnowotnik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-04T20:08:41.000Z","updated_at":"2025-06-03T07:43:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"b00943e3-fe80-4eef-b6de-d9ef643b217f","html_url":"https://github.com/mnowotnik/obsidian-user-plugins","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":"obsidianmd/obsidian-sample-plugin","purl":"pkg:github/mnowotnik/obsidian-user-plugins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnowotnik%2Fobsidian-user-plugins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnowotnik%2Fobsidian-user-plugins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnowotnik%2Fobsidian-user-plugins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnowotnik%2Fobsidian-user-plugins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnowotnik","download_url":"https://codeload.github.com/mnowotnik/obsidian-user-plugins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnowotnik%2Fobsidian-user-plugins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31308454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","obsidian","obsidian-md","obsidian-notes","obsidian-plugin"],"created_at":"2024-08-13T07:07:36.435Z","updated_at":"2026-04-02T14:55:52.864Z","avatar_url":"https://github.com/mnowotnik.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Obsidian User Plugins\n\nLets you use the Obsidian plugin API in your snippets or JavaScript files to modify the behavior of Obsidian, just as if you created a plugin, but without the hassle.\n\n# Stop and read\n\n\u003e :warning: **This plugin is for advanced users only**: DO NOT use code in scripts you do not fully understand. \n\u003e It can delete your notes or worse. See [legal notice](#Notice).\n\n# Caveats\n\n## Obsidian API compatibility\n\n\u003e :warning: Do not assume user scripts can run any Obsidian API functions other\n\u003e than what is shown in the examples. Creating settings is especially not supported, but it is on the [roadmap](#roadmap).\n\n## Versioning\n\nNewer versions of this plugin will usually require the newest Obsidian version due to its API changes. Consider this plugin \"bleeding edge\" for now.\n\n# Use cases\n\n- [Adding custom commands](https://docs.obsidian.md/Reference/TypeScript+API/Command)\n- Testing an idea for a plugin\n- Using Obsidian plugin API to do anything you want\n\n# Motivating example\n\nAdd command `Create new note in folder` that allows you to choose a folder\nbefore creating a note:\n\n```javascript\nmodule.exports = {\n    async onload(plugin) {\n        plugin.addCommand({\n            id: \"new-note-in-folder\",\n            name: \"Create new note in a folder\",\n            callback: async () =\u003e {\n                const api = plugin.api;\n                const folders = api.getAllFolders();\n                const folder = await api.suggest(folders, folders);\n                const createdNote = await plugin.app.vault.create(folder + \"/Hello World.md\", \"Hello World!\");\n                api.openFile(createdNote);\n            },\n        });\n    },\n    async onunload() {\n        // optional\n        console.log(\"unloading plugin\");\n    },\n};\n\n```\n\n![Command in palette](https://user-images.githubusercontent.com/8244123/167032593-0dbe59b1-2c2a-4700-83f4-01609cf0d30a.png)\n\n# Quick start\n\n## Installation\n\nYou can easily add this plugin from Community Plugins panel.\nAlternatively, here's a manual way:\n\nClone this repository into the `\u003cYOUR VAULT\u003e/.obsidian/plugins` folder and then execute:\n\n```bash\nnpm install\nnpm run build\n```\n\n## Usage\n\nYou can add scripts either by manually adding snippets or enabling each individual file in the defined scripts directory in your vault.\n\nTo use scripts, specify a scripts folder in settings, hit the reload button to search for scripts in the specified path,\nthen enable each script found using a toggle button.\n\nThere are a few types of scripts that you can use.\n\n### Obsidian plugin type\n\nHas the basic structure of an Obsidian plugin:\n\n```typescript\nimport { Plugin } from \"obsidian\";\n\nexport default class MyPlugin extends Plugin {\n\tasync onload() {\n        // code here\n\t}\n}\n```\nWritten in either [Typescript](./examples/ts-plugin/main.ts) or [Javascript](./examples/js-plugin/plugin.js) flavour.\n\nYou have access to [Helper API](#helper-api) by getting `obsidian-user-plugins` via `this.app.plugins.getPlugin`.\n\n### Module type\n\nA JavaScript module that exports at least an `async onload(plugin): void` method and\noptionally an `async onnunload(): void` method. It has access to the global function\n`require` to get the `obsidian` module.\nThe `plugin` parameter is an instance of `obsidian-user-plugins` with the [Helper API](#helper-api). \n\nSee [example](./examples/js-module/module.js).\n\n### Snippet\n\nA snippet is a JavaScript block of code that has access to the global `plugin`\nvariable. It also has access to the global function `require` to get the `obsidian`\nmodule. Snippets are executed during the plugin initialization phase in `onload()`.\nYou can also access [Helper API](#helper-api) via the `plugin.api` object.\n\nSee [example](./examples/js-snippet/snippet.js).\n\n# Helper API\n\nThis plugin exposes an `api` object with handy methods. Check them out [here](./src/helpers/Helpers.ts).\n\n# Roadmap\n\n- [ ] Custom configuration per script file\n- [ ] Additional functions in the [Helper API](#helper-api)\n\n# Obsidian Plugin API\n\nThe Obsidian plugin API is declared [here](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts).\n\nThe [Obsidian Developer platform](https://docs.obsidian.md/Reference/TypeScript+API/) contains extensive documentation for the various plugin methods and interfaces, e.g. for the [Command](https://docs.obsidian.md/Reference/TypeScript+API/Command) interface or the [Plugin](https://docs.obsidian.md/Reference/TypeScript+API/Plugin) class. \n\n# Notice\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnowotnik%2Fobsidian-user-plugins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnowotnik%2Fobsidian-user-plugins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnowotnik%2Fobsidian-user-plugins/lists"}