TIL - making an Obsidian plugin (minimal guide)

2025-10-20   blogpage sketch til obsidian


1. Minimal plugin (main.js):

module.exports = class EditSelectionPlugin {
  onload() {
    this.addCommand({
      id: 'edit-selection',
      name: 'Edit Selected Text',
      editorCallback: (editor) => {
        const sel = editor.getSelection();
        editor.replaceSelection(sel.toUpperCase());
      }
    });
  }
}

2. manifest.json:

{
  "id": "edit-selection",
  "name": "Edit Selection",
  "version": "1.0.0",
  "minAppVersion": "0.1.0",
  "author": "You",
  "main": "main.js"
}

3. Enable it:

Place both files in <vault>/.obsidian/plugins/edit-selection/

Reload Obsidian → Settings → Community Plugins → Enable “Edit Selection”

Use Cmd+P → Edit Selected Text




Incoming Internal References (0)

Outgoing Internal References (0)

Outgoing Web References (0)

Receive my updates

Barış Özmen © 2025