GitHub autolinks
Opt-inRewrite 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
| Pattern | Example | Output URL |
|---|---|---|
| Bare issue / PR | #123 | https: |
| Cross-repo issue / PR | user/repo#456 | https: |
| Commit SHA (7–40 hex chars) | abc1234 | https: |
Bare issue reference
See #123 for the fix.
Renders as: See <a href=
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.