fix(formatter): link branch and tag titles

This commit is contained in:
RhenCloud committed 2026-10-01 18:40:02 +08:00
1 parent b7fd31a665
commit 3567c6d321
7 files changed
+45 -8

No files matched your search

+13
View File
@@ -83,6 +83,19 @@ export function tagLink(baseUrl: string | undefined, tag: string, label?: string
: `\`${display}\``;
}
/** URL for a branch or tag, when the repository base URL is available. */
export function refUrl(
baseUrl: string | undefined,
ref: string,
type: "branch" | "tag",
): string | undefined {
if (!baseUrl) return undefined;
const clean = ref.replace("refs/heads/", "").replace("refs/tags/", "");
return type === "tag"
? `${baseUrl}/releases/tag/${encodeRefPath(clean)}`
: `${baseUrl}/tree/${encodeRefPath(clean)}`;
}
/* ---- Content size limits (mirror the Discord embed limits) ---- */
export const MAX_TITLE = 256;
export const MAX_DESCRIPTION = 4096;