Skip to content

About

Personal plugin registry for TriliumNext Plugin Manager

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

57 Commits

Folders and files

Repository files navigation

🧩 TriliumNext Script Manager (Scripts, Widgets & Render Notes)

A self-contained script manager that lives inside TriliumNext. Install, update, and remove scripts, widgets, and render notes with a single click β€” no external tools, no CLI, no wrappers.

Terminology note: TriliumNext uses the official Trilium terms scripts, custom widgets, launch bar widgets, render notes, backend scripts and themes β€” there is no official "plugin" concept. This tool was previously called "Plugin Manager"; the docs now use the official terms.

Render Note β†’ Fetch registry β†’ Show cards β†’ Install / Update / Uninstall

How it works

The Script Manager is a JS Frontend Render Note. On load, it fetches a registry (a JSON file hosted anywhere public), renders a card-based UI, and lets you install, update, or remove scripts/widgets.

Two installation methods:

Method How it works Token needed?
sourceUrl (recommended) Downloads the .js/.jsx source directly and creates a code note ❌ No
zipUrl (fallback) Downloads a ZIP for manual import via Options β†’ Import βœ… Yes

For the sourceUrl method, no ETAPI token is required β€” the script is created as a code note in one atomic backend call. No HTTP, no ZIP, no deadlock.


Features

  • Install scripts/widgets from a remote or local registry with one click
  • Update detection β€” cards turn yellow when a newer version is available
  • Uninstall β€” removes the script note cleanly
  • Remote registry with automatic fallback to local note content
  • Source indicator β€” shows remote/local source and last fetch time
  • Dual mode β€” sourceUrl (zero-config) or zipUrl (legacy) per entry
  • Inherits the active TriliumNext theme via CSS variables

Quick Start

1. Create the required notes

Plugin Manager         ← Code note, MIME: application/javascript;env=frontend  (paste the JS code)
β”œβ”€β”€ plugin-registry    ← Code note, MIME: application/json  (registry JSON + config labels)
└── Installed          ← Text note  (receives installed scripts as child notes)

2. Add labels

On plugin-registry:

Label Value Required
#pluginRegistry (no value β€” marks the note) βœ…
#registryUrl URL to your registry.json optional

On Installed:

Label Value Required
#installedPlugins (no value β€” marks the note) βœ…

ℹ️ #etapiToken and #triliumPort are no longer required when your registry uses sourceUrl entries (recommended). They are only needed if you plan to install legacy zipUrl-based scripts.

3. Paste the code

  1. Create a Code note with MIME application/javascript;env=frontend
  2. Paste the contents of trilium-plugin-manager-v4.js
  3. Add a ~renderNote relation pointing to the note where you want the panel to appear
  4. Open the target note

4. (Optional) Set up a remote registry

Create a public GitHub Gist with a registry.json file. Copy the Raw URL and add it as #registryUrl on the plugin-registry note.


Registry format

{
  "plugins": [
    {
      "id": "weekly-planner",
      "name": "Weekly Planner",
      "version": "1.0.0",
      "author": "your-github-username",
      "description": "Weekly planning board with columns.",
      "tags": ["productivity", "planning"],
      "sourceUrl": "https://raw.githubusercontent.com/user/repo/main/planner.jsx",
      "labels": [ { "name": "widget" }, { "name": "readOnly" } ],
      "zipUrl": "https://github.com/user/repo/raw/main/planner.zip"
    }
  ]
}
Field Required Description
id βœ… Unique identifier β€” used to track installation state
name βœ… Display name shown in the UI
version βœ… Semver string (1.0.0)
author Author name
description Short card description
tags Array of tag strings
homepage URL to the script's docs or repository β€” shows a "How to" button on the card
sourceUrl Raw URL to the .js/.jsx source file
labels Array of { "name", "value" } applied to the created note in the single-file flow β€” e.g. widget, readOnly
manifestUrl Raw URL to a manifest.json for multi-note scripts (see below)
zipUrl Legacy URL to a Trilium export ZIP

At least one of sourceUrl, manifestUrl or zipUrl must be provided.


Script formats

Single-file (sourceUrl)

A single .js or .jsx file. The Script Manager downloads it and creates one code note.

sourceUrl β†’ download β†’ create code note β†’ done

Multi-note (manifestUrl)

For scripts that need multiple notes (widget + handler + config + render note). The manifestUrl points to a JSON file describing the notes to create:

{
  "notes": [
    {
      "title": "My Plugin",
      "type": "text",
      "content": "Open this note to use the script.",
      "children": [
        {
          "title": "My Plugin Code",
          "type": "code",
          "mime": "application/javascript;env=frontend",
          "sourceUrl": "code.js"
        },
        {
          "title": "My Plugin Config",
          "type": "text",
          "content": "Configure the script here."
        }
      ]
    }
  ],
  "relations": [
    { "type": "renderNote", "from": "My Plugin", "to": "My Plugin Code" }
  ],
  "labels": [
    { "note": "My Plugin Code", "name": "readOnly", "value": "" },
    { "note": "My Plugin Config", "name": "myPluginConfig", "value": "" }
  ]
}

Each note can have a recursive children array: the parent note (e.g. the render note) is created first and the children (code, config, related notes) are created inside it, building a real tree in Trilium instead of flat notes. Notes with sourceUrl fetch the source file (relative to the manifest URL). Labels and relations from the manifest are applied automatically (labels/relations reference notes by title).

manifestUrl β†’ download manifest β†’ for each note: create + create its children β†’ apply labels β†’ create relations β†’ done

ZIP (zipUrl, legacy)

Downloads the ZIP to the user's browser for manual import via Options β†’ Import. Requires an ETAPI token.


Install flows

manifestUrl install

  1. Downloads the manifest JSON
  2. Creates all notes described in the manifest
  3. Applies labels and ~renderNote relations
  4. βœ… No token, no ZIP, no deadlock

sourceUrl install

  1. Backend downloads the source file via HTTPS
  2. Creates a code note with MIME application/javascript;env=frontend
  3. Sets #pluginId, #pluginVersion, #pluginName labels
  4. Applies labels from the registry entry (e.g. widget, readOnly)
  5. βœ… Done

zipUrl install (legacy)

  1. Downloads the ZIP to the user's browser
  2. User imports manually via Options β†’ Import

Update detection

On every load, the manager compares the version field in the registry against the #pluginVersion label on each installed note:

  • Same version β†’ green card, βœ“ v1.0.0
  • Registry is newer β†’ yellow card, ↑ v0.5.0 β†’ v1.0.0
  • Not installed β†’ default card + Install button

Files

File Description
trilium-plugin-manager-v4.js Main file β€” paste into a JS Frontend note
trilium-plugin-manager-v4.html Legacy HTML version (kept for reference)
registry.json Example registry with official scripts
PLUGIN_DEV_GUIDE.md Guide for creating and publishing scripts
MANIFEST_GENERATOR.md Fill-in-the-blank prompt to generate manifest.json

Roadmap

  • Script changelog field
  • Startup update badge
  • One-click "Export as script" helper note

License

MIT

β˜• Support this project

πŸ‡§πŸ‡· Pix: ricardograca@ricolandia.com
πŸ’³ PayPal: Donate
🧑 GitHub Sponsors: github.com/sponsors/ricolandia


Screenshots

screen capture screen capture

About

Personal plugin registry for TriliumNext Plugin Manager

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages