From e623e0fce62ccd03ce4ee657597486c1807b1ffb Mon Sep 17 00:00:00 2001 From: Ashour Badine Date: Sat, 17 Jan 2026 18:02:28 -0600 Subject: [PATCH] fix issue #5495: Tag parsing truncates emojis with variation selectors --- plugin/markdown/parser/tag.go | 11 +++++++++++ plugin/markdown/parser/tag_test.go | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/plugin/markdown/parser/tag.go b/plugin/markdown/parser/tag.go index 15dc9ca4c..59baadbcb 100644 --- a/plugin/markdown/parser/tag.go +++ b/plugin/markdown/parser/tag.go @@ -47,6 +47,17 @@ func isValidTagRune(r rune) bool { return true } + // Allow marks (non-spacing, spacing combining, enclosing) + // This covers variation selectors (e.g. VS16 \uFE0F) and combining marks (e.g. Keycap \u20E3, accents) + if unicode.IsMark(r) { + return true + } + + // Allow Zero Width Joiner (ZWJ) for emoji sequences + if r == '\u200D' { + return true + } + // Allow specific ASCII symbols for tag structure // Underscore: word separation (snake_case) // Hyphen: word separation (kebab-case) diff --git a/plugin/markdown/parser/tag_test.go b/plugin/markdown/parser/tag_test.go index 6150c4487..817e27c3a 100644 --- a/plugin/markdown/parser/tag_test.go +++ b/plugin/markdown/parser/tag_test.go @@ -168,6 +168,18 @@ func TestTagParser(t *testing.T) { expectedTag: "test🚀", shouldParse: true, }, + { + name: "emoji with VS16", + input: "#test👁️", // Eye + VS16 + expectedTag: "test👁️", + shouldParse: true, + }, + { + name: "emoji with ZWJ sequence", + input: "#family👨‍👩‍👧‍👦", // Family ZWJ sequence + expectedTag: "family👨‍👩‍👧‍👦", + shouldParse: true, + }, } for _, tt := range tests {