Strip citation prefix in citation badges

This commit is contained in:
LofiSu
2026-02-09 22:57:54 +08:00
parent 1af14bf7e4
commit f8e4fe05b2

View File

@@ -17,7 +17,10 @@ export function CitationLink({
const domain = extractDomain(href ?? "");
// Priority: children > domain
const childrenText = typeof children === "string" ? children : null;
const childrenText =
typeof children === "string"
? children.replace(/^citation:\s*/i, "")
: null;
const isGenericText = childrenText === "Source" || childrenText === "来源";
const displayText = (!isGenericText && childrenText) ?? domain;