Skip to content

Repository files navigation

GitHub PR Linker

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)

Supported formats

repo#123
owner/repo#123
repo/pull/123
owner/repo/pull/123
https://github.com/owner/repo/pull/123
  • repo#123 and repo/pull/123 use 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 http or https, include www., and carry extra path segments, query strings, or fragments (e.g. /files or #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 ownerrepo#123 for your own repositories, owner/repo#123 for 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.

Installation

Manual installation

  1. Download main.js and manifest.json from the latest release (or build them yourself, see below).
  2. Create the folder <your-vault>/.obsidian/plugins/github-pr-linker/.
  3. Copy main.js and manifest.json into that folder.
  4. In Obsidian, open Settings → Community plugins, refresh the list of installed plugins, and enable GitHub PR Linker.

Usage

  1. Open Settings → GitHub PR Linker and set your Default GitHub owner (your GitHub username or organization, e.g. thequietmind).
  2. In a note, type a pull request reference such as today#123 or owner/repo#456, a path such as today/pull/123, or paste a pull request URL.
  3. Select the reference.
  4. 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.

Assigning a keyboard shortcut

  1. Open Settings → Hotkeys.
  2. Search for Link GitHub pull request.
  3. Click the plus icon next to the command and press your preferred key combination, e.g. Cmd+Shift+L.

Development

Requires Node.js and npm.

npm install
  • npm run dev — build in watch mode with inline sourcemaps.
  • npm run build — typecheck and produce a minified production main.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.

License

MIT © Quiet Mind Creative, Inc.

About

Obsidian GitHub Linker Plugin

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages