zfb

Type to search...

to open search from anywhere

GitHub autolinks

Opt-in
CreatedJun 1, 2026Takeshi Takatsudo

Rewrite bare #123, user/repo#456, and commit-SHA references in Markdown text into hyperlinks pointing at a configured GitHub repository.

The githubAutolinks feature rewrites bare issue, pull-request, and commit-SHA references in plain text into <a> hyperlinks pointing at a configured GitHub repository. This mirrors the autolink behaviour that GitHub renders natively in README files and issues.

Enable

The repo field is required. The feature is silently inactive when it is absent.

// zfb.config.ts
export default defineConfig({
  markdown: {
    features: {
      githubAutolinks: {
        repo: "owner/repo",
      },
    },
  },
});

Recognised patterns

PatternExampleOutput URL
Bare issue / PR#123https://github.com/{repo}/issues/123
Cross-repo issue / PRuser/repo#456https://github.com/user/repo/issues/456
Commit SHA (7–40 hex chars)abc1234https://github.com/{repo}/commit/abc1234

Bare issue reference

See #123 for the fix.

Renders as: See <a href="https://github.com/owner/repo/issues/123">#123</a> for the fix.

Cross-repo reference

Backported from other/project#7.

Renders using the inline owner/repo, not the configured repo.

Commit SHA

A 7–40 character lowercase hex string surrounded by word boundaries is treated as a commit SHA.

Fixed in abc1234.

Exclusions

References inside code spans and fenced code blocks are never rewritten:

Use `#123` as a literal reference — no link produced.

```
#123 and abc1234 are not linked in code blocks.
```

Notes

  • Cross-repo references always use the owner/repo embedded in the text, not the configured repo.
  • SHA disambiguation: a run of 7–40 characters that is all decimal digits is treated as a plain number, not a SHA. Mixed hex (e.g. abc1234) is linked.
  • Existing links are not double-wrapped — text inside <a> elements is left unchanged.

Revision History