feat: add obsidian:// URI handler for saving posts via protocol link

This commit is contained in:
@gapmiss 2026-07-17 20:45:56 -05:00
parent cd4cfb0802
commit 882487103f
2 changed files with 28 additions and 0 deletions

View file

@ -61,6 +61,22 @@ Substacks/
The main note includes frontmatter with title, subtitle, type, audience, date, comment count, and links to all media. Comments are embedded via `![[slug-comments]]`.
### URI protocol
You can save a post directly via an `obsidian://` URI without opening the command palette:
```
obsidian://substack-clipper?vault=MyVault&url=https://alice.substack.com/p/my-article
```
| Parameter | Required | Description |
|-----------|----------|-------------|
| `vault` | no | Target vault name (Obsidian prompts if omitted and multiple vaults exist) |
| `url` | yes | Full Substack post URL (must contain `/p/`) |
| `open` | no | `true` or `false` — override the "open after saving" setting |
Spaces in vault names should be percent-encoded (`%20`). This works from browsers, scripts, iOS Shortcuts, bookmarklets, and anywhere else that can open a URL.
## Settings
| Setting | Default | Description |

View file

@ -40,6 +40,18 @@ export default class SubstackClipperPlugin extends Plugin {
void this.activateHistoryView();
},
});
this.registerObsidianProtocolHandler('substack-clipper', (params) => {
const url = params.url;
if (!url || !url.includes('/p/')) {
new Notice('Invalid substack-clipper uri — a "URL" parameter containing /p/ is required.');
return;
}
const openAfterClip = params.open === 'true' ? true
: params.open === 'false' ? false
: this.settings.openAfterClip;
void this.clipPost(url, openAfterClip);
});
}
async activateHistoryView(): Promise<void> {