Using the @ and # symbols in tweets with a word joiner character
Last modified:
When scrolling through Svelte tweets in my Twitter timeline, occasionally, I see tweets about the
Svelte template syntax which contain strings like
@const (referring to the {@const ...}
tag) or #if
(referring to an {#if ...}
block).
Since @
and #
have special meanings in tweets, Twitter interprets the string @const as a mention
of Twitter user Konstantin Martynov (whose Twitter username happens to
be @const). Likewise, Twitter interprets the string #if as a hashtag and links straight to a dodgier
part of Twitter.
But there are tweets like this one by Geoff Rich that contain the @const string without displaying it as a mention:
How did Geoff pull this off? Copying the @const string from the original tweet and displaying its second character like so
const string = '@const';
string.charCodeAt(1);
yields 8203
corresponding to 0x200B
(hexadecimal). This is the U+200B ZERO-WIDTH SPACE
Unicode character. An invisible space between @ and const keeps Twitter from displaying the string
as a mention.
To avoid a potential line break between @ and const, you should use the U+2060 WORD JOINER Unicode character instead. How can you insert a word joiner character into your tweet? Click the button below to copy a word joiner and paste it into your tweet draft.