Documentation
Everything you need to build and publish Schrödinger plugins.
Quick Start
A plugin is a directory inside ~/.schrodinger/plugins/ containing a
plugin.json manifest and a JavaScript entry file.
Directory structure
~/.schrodinger/plugins/my-plugin/
├── plugin.json
└── index.js Manifest
The plugin.json file describes your plugin:
plugin.json
{
"id": "my-plugin",
"name": "My Plugin",
"version": "0.1.0",
"description": "What it does",
"author": "you",
"type": "script",
"platforms": ["macos", "linux", "windows"],
"entry": "index.js",
"modes": [
{ "id": "mode-a", "label": "Mode A", "default": true },
{ "id": "mode-b", "label": "Mode B" }
],
"config": {}
} The modes field is optional. Omit it for single-behavior plugins.
Plugin Code
index.js
export default {
id: "my-plugin",
label: "My Plugin",
appliesTo(entry) {
return entry.formats.some(
f => f.format === schrodinger.textFormat()
);
},
async apply(entry, mode) {
const buf = await schrodinger.readFormat(
entry, schrodinger.textFormat()
);
const text = schrodinger.decode(buf);
const result = transform(text, mode);
return [{
format: schrodinger.textFormat(),
data: schrodinger.encode(result)
}];
}
}; Plugin API
The schrodinger global is available in all plugins:
| Method | Description |
|---|---|
schrodinger.textFormat() | Platform text format name |
schrodinger.htmlFormat() | Platform HTML format name |
schrodinger.imageFormats() | Array of platform image format names |
schrodinger.readFormat(entry, format) | Read raw bytes for a format |
schrodinger.decode(buffer) | Decode ArrayBuffer to UTF-8 string |
schrodinger.encode(string) | Encode string to ArrayBuffer |
schrodinger.getConfig() | Get plugin configuration values |
Entry Object
TypeScript interface
interface PluginEntry {
changeCount: number;
formats: { format: string; size: number }[];
category: string; // "text", "html", "image", "files", "other"
preview: string;
} Publishing
- Create a GitHub repo for your plugin
- Tag a release and attach a
.tar.gzarchive of your plugin directory - Submit a PR to schrodinger-registry adding your entry to
registry.json