Website feedback: escape & so entities can't rebuild mentions; queue only lgtm comments

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 14:39:54 +10:00
1 parent 0037b1ef4b
commit cd40a194ed
3 files changed
+10 -6

No files matched your search

+3 -1
View File
@@ -19,10 +19,12 @@ const oneLine = (value, max) => String(value ?? "").replace(/\s+/g, " ").trim().
// Mentions in someone else's text would ping strangers, and issue references
// (#1, owner/repo#1, GH-1, github.com links) would add backlinks to other
// people's issues, so break them all with a zero-width space.
// people's issues, so break them all with a zero-width space. Escaping & first
// stops &commat; and &num; from turning back into @ and # when GitHub renders.
const ZWSP = "\u200b";
export function defang(text) {
return text
.replace(/&/g, "&amp;")
.replace(/@(?=[A-Za-z0-9])/g, `@${ZWSP}`)
.replace(/#(?=\d)/g, `#${ZWSP}`)
.replace(/\b(GH)-(?=\d)/gi, `$1${ZWSP}-`)