Repository navigation
Plugin Development Guide
Imladris features a sandboxed, Obsidian-inspired extension system powered by JavaScriptCore (JSC.Context). Third-party developers can author extensions in TypeScript (recommended, with full type definitions) or JavaScript, test them locally, and publish them directly to the Imladris Community Plugins Registry so every user can search and install them in one click from inside the app.
Note
Licensing Freedom (Apache-2.0 Hybrid Open-Core): Third-party extensions communicating through the imladris.* JavaScript API are independent works. You may license your plugin under any license you prefer (Apache-2.0, MIT, BSD, GPLv3, or internal proprietary enterprise license).
Every plugin runs inside its own isolated JSC.Context virtual machine with:
- A declarative
manifest.jsondeclaring metadata and explicit permissions (editor,repl_r,repl_python,elrond_ai,workspace,ui). - A compiled ES2019 entry point
main.jsexposing two global lifecycle hooks:onload()andonunload(). - A host API object
imladris(imladris.ui,imladris.editor,imladris.repl,imladris.elrond,imladris.workspace,imladris.plugin). - Native GNOME HIG & Papirus symbolic icons so extensions match both Light and Dark themes seamlessly.
Imladris ships official TypeScript ambient declarations at community-plugins/types/imladris.d.ts.
my-biostat-plugin/
├── manifest.json
├── tsconfig.json
├── src/
│ └── main.ts
└── main.js # Compiled output loaded by Imladris
{
"id": "my-biostat-plugin",
"name": "APA & Lancet Table Formatter",
"version": "1.0.0",
"author": "Your Name or Lab",
"description": "Inserts publication-ready gt() and gtsummary R summary tables for the selected dataframe.",
"license": "Apache-2.0",
"icon": "x-office-spreadsheet-symbolic",
"permissions": [
"editor",
"repl_r"
]
}| Permission | Capability Granted |
|---|---|
"editor" |
Read active document/selection and insert text at cursor (imladris.editor.*) |
"repl_r" |
Execute R code in the persistent R session (imladris.repl.runR) |
"repl_python" |
Execute Python code in the persistent Python session (imladris.repl.runPython) |
"elrond_ai" |
Send prompts to Elrond AI Assistant (imladris.elrond.ask) |
"workspace" |
List, read, and open files inside the active project root (imladris.workspace.*) |
"ui" |
Open custom HTML5/Canvas/WebGL modal dialogs (imladris.ui.openWebDialog) |
Important
id must be 1–64 characters containing only a-z, A-Z, 0-9, -, and _. Always request the minimum set of permissions your plugin needs—users review every permission in a consent dialog before installing.
Because JSC.Context evaluates main.js as a single self-contained script (not an ES module with import/export), compile with "module": "None" and "outFile": "./main.js" (or bundle with esbuild using --format=iife if using npm helpers):
{
"compilerOptions": {
"target": "ES2019",
"module": "None",
"strict": true,
"outFile": "./main.js",
"lib": ["ES2019"]
},
"include": ["src/main.ts", "../../types/imladris.d.ts"]
}// src/main.ts — Type-safe Imladris Plugin
function buildTableChunk(datasetName: string): string {
const safe = datasetName.trim().replace(/[^a-zA-Z0-9_.]/g, "") || "mtcars";
return [
"",
"```{r}",
"#| label: tbl-summary",
`#| tbl-cap: "Summary statistics for ${safe}"`,
"library(gt)",
`${safe} |> head(10) |> gt()`,
"```",
""
].join("\n");
}
function onload(): void {
imladris.ui.addRibbonButton({
id: "insert-apa-table",
label: "APA Table",
icon: "x-office-spreadsheet-symbolic",
onClick: () => {
const selected = imladris.editor.getSelectedText();
const dataset = selected && selected.trim().length > 0 ? selected.trim() : "mtcars";
imladris.editor.insertAtCursor(buildTableChunk(dataset));
imladris.ui.showToast(`Inserted APA table chunk for '${dataset}'`);
}
});
}
function onunload(): void {
// Ribbon buttons are removed automatically by PluginManager
}npx tsc -p tsconfig.json(If your plugin imports helper libraries, bundle them into a single file via npx esbuild src/main.ts --bundle --target=es2019 --outfile=main.js while exposing globalThis.onload = onload and globalThis.onunload = onunload.)
For lightweight plugins without a build step, place manifest.json and main.js directly in your plugin folder:
// main.js
function onload() {
imladris.ui.addRibbonButton({
id: "insert-iso-date",
label: "ISO Date",
icon: "alarm-symbolic",
onClick: function () {
var iso = new Date().toISOString().slice(0, 10);
imladris.editor.insertAtCursor(iso);
imladris.ui.showToast("Inserted " + iso);
}
});
}
function onunload() {
}Imladris automatically scans both directories at startup:
-
Native / Host install:
~/.local/share/imladris/plugins/<your-plugin-id>/ -
Flatpak install:
~/.var/app/io.github.Antux912012.Imladris/data/imladris/plugins/<your-plugin-id>/(and also reads~/.local/share/imladris/plugins/)
Copy manifest.json and main.js into that folder, then open Preferences → Extensions (Ctrl+,) and toggle your plugin on.
zip -r my-biostat-plugin.implugin my-biostat-plugin/manifest.json my-biostat-plugin/main.jsAny user can install it offline via Preferences → Extensions → Import Plugin… (supports .implugin and .zip; symlinks and path traversal are strictly blocked).
Once your plugin works locally, publish it to Antux912012/imladris so all Imladris users can find and install it in one click from Preferences → Extensions → Community Plugins (or via Command Palette → Browse Community Plugins…).
-
Fork & Branch:
git clone https://github.com/<your-username>/imladris.git cd imladris git checkout -b plugin/my-biostat-plugin
-
Add Your Plugin Folder under
community-plugins/plugins/<id>/:community-plugins/plugins/my-biostat-plugin/ ├── manifest.json # Required ├── main.js # Required (compiled ES2019 JS) ├── tsconfig.json # Recommended if written in TypeScript └── src/ └── main.ts # Recommended TypeScript source for transparency -
Register Your Plugin in
community-plugins/registry.json: Add an entry inside the"plugins"array:{ "id": "my-biostat-plugin", "name": "APA & Lancet Table Formatter", "version": "1.0.0", "author": "Your Name", "description": "Inserts publication-ready gt() and gtsummary R summary tables.", "license": "Apache-2.0", "icon": "x-office-spreadsheet-symbolic", "category": "Biostatistics", "language": "TypeScript", "tags": ["r", "tables", "apa", "gt", "clinical"], "permissions": ["editor", "repl_r"], "homepage": "https://github.com/Antux912012/imladris/tree/main/community-plugins/plugins/my-biostat-plugin", "files": { "manifest": "community-plugins/plugins/my-biostat-plugin/manifest.json", "main": "community-plugins/plugins/my-biostat-plugin/main.js" } }(Optional: If your plugin includes static assets such as HTML/CSS templates, add an
"assets": { "template.html": "community-plugins/plugins/<id>/template.html" }map inside"files". If you host releases on your own GitHub repo, you may alternatively provide an HTTPS"archive_url"pointing to a.impluginrelease zip.) -
Review Checklist Before Opening Your PR:
-
manifest.jsonidmatches the folder name andregistry.jsonid. -
main.jsis freshly compiled and contains no syntax errors or externalrequire()/importstatements. - All requested
permissionsare minimal and accurately declared in bothmanifest.jsonandregistry.json. - No hardcoded secrets, tracking pixels, or insecure
http://URLs.
-
-
Open a Pull Request against
mainonAntux912012/imladris. As soon as the PR is merged, Imladris fetches the updatedcommunity-plugins/registry.jsonautomatically and your extension appears in the in-app Community Plugins search!
- Open Preferences (
Ctrl+,) → Extensions (or pressCtrl+Shift+Pand run Browse Community Plugins…). - Type keywords into the Community Plugins search box (searches by name, description, author, category, tags, or
TypeScript/JavaScript). - Expand any result to inspect its description, requested permissions, tags, and GitHub source link.
- Click Install, review and approve the permission consent prompt, and the plugin is downloaded, validated, and activated immediately in your Ribbon!
- Explore every host method in the Plugin API Reference.
- Inspect working TypeScript and JavaScript reference plugins in
community-plugins/plugins/.
Imladris IDE (v0.45.0) • Core licensed under Apache License 2.0 (Apache-2.0) (Hybrid Open-Core) • Built with Vala, GTK4, Libadwaita, WebKitGTK 6.0 & Papirus Icons (GPL-3.0-or-later).