Fix apostrophe rendering: prevent HTML entities from matching as tags

The TAG_RE regex in linkifyTags() was matching #39 inside ' as a
tag, breaking the HTML entity and preventing apostrophe rendering.
Added (?<!&) negative lookbehind so # preceded by & is skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-10 21:59:02 -05:00
parent 38b1ac933e
commit de899ebc50
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
const CODE_FENCE_RE = /```[\s\S]*?```|`[^`\n]+`/g;
const TAG_RE = /(?<!\w)#([\w]+(?:\/[\w]+)*)/g;
const TAG_RE = /(?<!\w)(?<!&)#([\w]+(?:\/[\w]+)*)/g;
function escapeHtmlAttr(s: string): string {
return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");