User Plugins

by mnowotnik
5
4
3
2
1
Score: 61/100

Description

Category: Coding & Technical Tools

The User Plugins plugin allows advanced users to leverage the Obsidian Plugin API within JavaScript snippets or modules, enabling custom modifications to Obsidian's behavior without the complexity of creating full-fledged plugins. Users can add commands, test plugin ideas, or execute any desired functionality with Obsidian's API. The plugin supports multiple script types, including plugins, modules, and snippets, and provides a Helper API for easier development. This tool is ideal for users seeking flexible, script-based customizations.

Reviews

No reviews yet.

Stats

88
stars
5,905
downloads
3
forks
1,436
days
539
days
539
days
2
total PRs
0
open PRs
1
closed PRs
1
merged PRs
4
total issues
0
open issues
4
closed issues
7
commits

Latest Version

a year ago

Changelog

  • the scripts can be now JS Obsidian plugins or compiled TS Obsidian plugins
  • add better notifications on errors
  • add more helper methods: openFile, notify, getAllFolders
  • deprecated passedModules and helpers. Use global require and plugin.api instead

README file from

Github

Obsidian User Plugins

Lets 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.

Stop and read

:warning: This plugin is for advanced users only: DO NOT use code in scripts you do not fully understand. It can delete your notes or worse. See legal notice.

Caveats

Obsidian API compatibility

:warning: Do not assume user scripts can run any Obsidian API functions other than what is shown in the examples. Creating settings is especially not supported, but it is on the roadmap.

Versioning

Newer versions of this plugin will usually require the newest Obsidian version due to its API changes. Consider this plugin "bleeding edge" for now.

Use cases

Motivating example

Add command Create new note in folder that allows you to choose a folder before creating a note:

module.exports = {
    async onload(plugin) {
        plugin.addCommand({
            id: "new-note-in-folder",
            name: "Create new note in a folder",
            callback: async () => {
                const api = plugin.api;
                const folders = api.getAllFolders();
                const folder = await api.suggest(folders, folders);
                const createdNote = await plugin.app.vault.create(folder + "/Hello World.md", "Hello World!");
                api.openFile(createdNote);
            },
        });
    },
    async onunload() {
        // optional
        console.log("unloading plugin");
    },
};

Command in palette

Quick start

Installation

You can easily add this plugin from Community Plugins panel. Alternatively, here's a manual way:

Clone this repository into the <YOUR VAULT>/.obsidian/plugins folder and then execute:

npm install
npm run build

Usage

You can add scripts either by manually adding snippets or enabling each individual file in the defined scripts directory in your vault.

To use scripts, specify a scripts folder in settings, hit the reload button to search for scripts in the specified path, then enable each script found using a toggle button.

There are a few types of scripts that you can use.

Obsidian plugin type

Has the basic structure of an Obsidian plugin:

import { Plugin } from "obsidian";

export default class MyPlugin extends Plugin {
	async onload() {
        // code here
	}
}

Written in either Typescript or Javascript flavour.

You have access to Helper API by getting obsidian-user-plugins via this.app.plugins.getPlugin.

Module type

A JavaScript module that exports at least an async onload(plugin): void method and optionally an async onnunload(): void method. It has access to the global function require to get the obsidian module. The plugin parameter is an instance of obsidian-user-plugins with the Helper API.

See example.

Snippet

A snippet is a JavaScript block of code that has access to the global plugin variable. It also has access to the global function require to get the obsidian module. Snippets are executed during the plugin initialization phase in onload(). You can also access Helper API via the plugin.api object.

See example.

Helper API

This plugin exposes an api object with handy methods. Check them out here.

Roadmap

  • Custom configuration per script file
  • Additional functions in the Helper API

Obsidian Plugin API

The Obsidian plugin API is declared here.

The Obsidian Developer platform contains extensive documentation for the various plugin methods and interfaces, e.g. for the Command interface or the Plugin class.

Notice

THE 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.

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
API Designer
5 months ago by Ruveyda Yilmaz
A plugin for Obsidian that lets you design and document API endpoints visually without leaving your notes.
APIRequest
3 years ago by rooyca
Obsidian plugin that allows you to integrate API data into your notes with request caching, variable support, and precise JSON extraction.
Babashka
3 years ago by Filipe Silva
Run Obsidian Clojure(Script) codeblocks in Babashka.
CustomJS
5 years ago by Sam Lewis
An Obsidian plugin to allow users to reuse code blocks across all devices and OSes
Data Fetcher
a year ago by qf3l3k
Fetch data from multiple sources (REST APIs, RPC, gRPC, GraphQL) and insert results into notes.
Execute Code
4 years ago by twibiral
Obsidian Plugin to execute code in a note.
File Publisher
3 years ago by Devin Sackett
Geocoding Properties
3 years ago by Jose Elias Alvarez
Insert address / location data from geocoding APIs as Obsidian properties.
Latex Render
2 years ago by jvsteiner
An Obsidian plugin that renders `label` code blocks to `<svg>` for viewing in notes. Make sure to bring your own command!
Local REST API
4 years ago by Adam Coddington
Unlock your automation needs by interacting with your notes in Obsidian over a secure REST API.
Magiedit
a year ago by Matteo Gassend
Media DB Plugin
4 years ago by Moritz Jung
A plugin that can query multiple APIs for movies, series, anime, games, music and wiki articles, and import them into your vault.
Obsidian to Flomo
4 years ago by Xiaoyu Li
Quickly share content to Flomo.
OpenAPI Renderer
2 years ago by Sentiago
Integrate OpenAPI specification management into Obsidian with features for version control, visualization, editing, and easy navigation of API specs.
Plugin REPL
a year ago by readwithai
An in-note Read Evaluate Print Loop to execute JavaScript within Obsidian
pycalc
a year ago by pycalc
Unofficial Fabric Integration
2 years ago by Chasebank87
Integrate fabric by danielmiessler/fabric into Obsidian