An Obsidian plugin that turns GitHub pull request references into Markdown links.
Write a reference like repo#1234, select it, run the Link GitHub pull request command, and it becomes:
[repo#1234](https://github.com/owner/repo/pull/1234)repo#123
owner/repo#123
repo/pull/123
owner/repo/pull/123
https://github.com/owner/repo/pull/123
repo#123andrepo/pull/123use the Default GitHub owner from the plugin settings.owner/repo#123,owner/repo/pull/123, and full URLs link to that owner directly, ignoring the default.- Owner and repository names may contain letters, numbers, hyphens, underscores, and periods.
- The pull request number must contain only digits.
- URLs may use
httporhttps, includewww., and carry extra path segments, query strings, or fragments (e.g./filesor#issuecomment-456). The generated link always points at the pull request itself, so deep-link suffixes are dropped.
For repo#123 and owner/repo#123, the selected text is preserved as the link label, so octocat/hello-world#789 becomes:
[octocat/hello-world#789](https://github.com/octocat/hello-world/pull/789)For /pull/ paths and URLs, the label is rewritten to the short reference form. By default https://github.com/octocat/hello-world/pull/789 becomes:
[hello-world#789](https://github.com/octocat/hello-world/pull/789)The Owner in link label setting controls whether these rewritten labels include the owner:
- Hide owner (default) — always
repo#123. - Show owner — always
owner/repo#123. - Show owner only when it differs from the default owner —
repo#123for your own repositories,owner/repo#123for everyone else's.
If nothing is selected, the selection does not match a supported format, or no default owner is configured for an ownerless reference, the plugin shows a notice and leaves your text untouched.
- Download
main.jsandmanifest.jsonfrom the latest release (or build them yourself, see below). - Create the folder
<your-vault>/.obsidian/plugins/github-pr-linker/. - Copy
main.jsandmanifest.jsoninto that folder. - In Obsidian, open Settings → Community plugins, refresh the list of installed plugins, and enable GitHub PR Linker.
- Open Settings → GitHub PR Linker and set your Default GitHub owner (your GitHub username or organization, e.g.
thequietmind). - In a note, type a pull request reference such as
today#123orowner/repo#456, a path such astoday/pull/123, or paste a pull request URL. - Select the reference.
- Open the command palette (
Cmd/Ctrl+P) and run Link GitHub pull request.
The selection is replaced with a Markdown link to the pull request on GitHub.
- Open Settings → Hotkeys.
- Search for
Link GitHub pull request. - Click the plus icon next to the command and press your preferred key combination, e.g.
Cmd+Shift+L.
Requires Node.js and npm.
npm installnpm run dev— build in watch mode with inline sourcemaps.npm run build— typecheck and produce a minified productionmain.js.npm test— run the unit tests with Vitest.
To test the plugin in a vault, clone this repository into <your-vault>/.obsidian/plugins/github-pr-linker/, run npm install and npm run build, then enable the plugin in Obsidian.