mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-21 01:23:40 +00:00
fix(formatter): link branch and tag titles
This commit is contained in:
7 files changed
+45
-8
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user