Skip to content

feat: show GitLab and Codeberg links the way GitHub ones are shown - #951

Merged
nunomaduro merged 2 commits into
dev-null-sh:productionfrom
zangetsu02:feat/other-git-hosts
Oct 26, 2026
Merged

nunomaduro merged 2 commits into
dev-null-sh:productionfrom
zangetsu02:feat/other-git-hosts

Conversation

@zangetsu02

@zangetsu02 zangetsu02 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #936

GitLab and Codeberg links now render like GitHub ones, with the forge's icon and owner/repo: repositories, issues and merge/pull requests. GitLab merge requests keep GitLab's own !42.

Link Shows as
gitlab.com/gitlab-org/gitlab GitLab icon + gitlab-org/gitlab
gitlab.com/gitlab-org/gitlab/-/issues/42 gitlab-org/gitlab#42
gitlab.com/gitlab-org/gitlab/-/merge_requests/42 gitlab-org/gitlab!42
codeberg.org/forgejo/forgejo/pulls/42 Codeberg icon + forgejo/forgejo#42

The GitHub-only pattern and component in linkified-text.tsx are now driven by a small forges table (host, owner pattern, item paths and their mark, reserved paths, icon), so GitHub behaves exactly as before and its existing tests pass unchanged. Icons come from Simple Icons (CC0).

Not covered: self-hosted Forgejo/Gitea instances, since there is no way to tell them apart by domain. GitLab subgroup projects (group/subgroup/project) stay plain URLs.

Tests: 21 new cases in tests/Unit/LinkifiedText.test.tsx (repositories, issues, MRs/PRs, static rendering, and links that must stay URLs).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for recognizing and displaying GitLab and Codeberg repository, issue, pull request, and merge request links, with forge-specific icons and labels.
  • Bug Fixes

    • Unsupported hosts and reserved repository paths remain ordinary links instead of being identified as forge links.

Repositories, issues and merge or pull requests on gitlab.com and
codeberg.org now show as their forge writes them, with its icon, like
GitHub links already do. GitLab merge requests keep GitLab's own "!".

Closes dev-null-sh#936

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jubianchi

Copy link
Copy Markdown
Contributor

@zangetsu02 can you add some screenshots of where and how it renders, please?

This really helps maintainers see the end result quickly and give feedback :)

@zangetsu02

zangetsu02 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @jubianchi, in the related issue there is a screenshot :)
#936

@jubianchi

Copy link
Copy Markdown
Contributor

my bad :)

…t-hosts

# Conflicts:
#	resources/js/components/linkified-text.tsx
#	tests/Unit/LinkifiedText.test.tsx
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f091a9ba-3340-4165-83a4-70e5d0585436
Commits

Reviewing files that changed from the base of the PR and between ac42dbc and cf20bed.

Files selected for processing: 4
  • resources/js/components/codeberg-icon.tsx
  • resources/js/components/gitlab-icon.tsx
  • resources/js/components/linkified-text.tsx
  • tests/Unit/LinkifiedText.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

LinkifiedText now formats GitLab and Codeberg repository, issue, merge-request, and pull-request URLs alongside GitHub URLs. Tests cover rendered labels, static rendering, and unsupported URL formats.

Changes: Forge link formatting

Layer / File(s) Summary
Forge definitions and URL matching
resources/js/components/linkified-text.tsx
Shared forge definitions configure URL hosts, paths, item labels, and reserved paths. The parser returns a forge target for supported URLs.
Forge link rendering and validation
resources/js/components/linkified-text.tsx, resources/js/components/codeberg-icon.tsx, resources/js/components/gitlab-icon.tsx, tests/Unit/LinkifiedText.test.tsx
Forge links use the configured icon, accessible label, and item mark. Tests cover GitLab and Codeberg links, static rendering, and unsupported URL formats.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant LinkifiedText
  participant forgeLinkTo
  participant ForgeLink
  participant ForgeIcon
  LinkifiedText->>forgeLinkTo: Parse URL into a forge target
  forgeLinkTo-->>LinkifiedText: Return matching forge target
  LinkifiedText->>ForgeLink: Render target
  ForgeLink->>ForgeIcon: Render configured forge icon
Loading

Suggested reviewers: jubianchi, xheaven

Merge Risk: Minimal · up to cf20b

GitHub link formatting remains intact, and no issue requiring a fix before merge was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding GitLab and Codeberg link formatting similar to the existing GitHub behavior.
Linked Issues check Passed Issue #936 requests GitHub-like formatting for other Git servers. The PR adds forge definitions for GitLab and Codeberg, repository and item matching, forge icons, repository labels, issue labels, and…
Out of Scope Changes check Passed The changed files support issue #936. The forge table refactors existing GitHub matching, the two icon components provide the requested visual markers, and the tests verify the new and preserved link …
Full details: Linked Issues check

Explanation

Issue #936 requests GitHub-like formatting for other Git servers. The PR adds forge definitions for GitLab and Codeberg, repository and item matching, forge icons, repository labels, issue labels, and GitLab merge-request !number labels. The 21 new tests cover these cases, static rendering, and links that must remain URLs. The stated limits for self-hosted Forgejo/Gitea and GitLab subgroup projects are consistent with the implementation and do not leave a specified issue requirement unmet.

Full details: Out of Scope Changes check

Explanation

The changed files support issue #936. The forge table refactors existing GitHub matching, the two icon components provide the requested visual markers, and the tests verify the new and preserved link behavior. No unrelated change is demonstrated.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@nunomaduro
nunomaduro merged commit cfe61a1 into dev-null-sh:production Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add formatting like GitHub links for other Git servers (e.g., Codeberg, GitLab, Forgejo, etc.)

3 participants