Which application or package is this feature request for?
formatters
Feature
There's currently many Discord-flavored markdown sequences that can be escaped by the formatters @discordjs/formatters package. However, there's one sequence that's not supported yet: the "hide link embed" sequence.
This causes strings, such as <a:/b> to be rendered as a:/b by the Discord client.
The same goes for the intended purpose, of this sequence: <https://discord.js.org/> renders as https://discord.js.org/.
Escaping this sequence would cause text to render correctly.
Ideal solution or implementation
I propose a sophisticated approach to escape any occurrence of the pattern /<[^<>\s:]+:\/[^<>\s]+>/g by surrounding it between \< and >.
E.g. escaping <https://discord.js.org/> would result in the string \<<https://discord.js.org/>>.
This correctly renders as <https://discord.js.org/> in the Discord client while the link embed remains hidden.
Please note that this solution is not yet ideal, since there are very complex interactions between the <a:/b> sequence when they're being used in combination with masked links.
Alternative solutions or implementations
My original approach was simpler:
Escape any occurrence of the character < with \<. This works similar to how escapeStrikethrough() and escapeSpoiler() already work. However, this causes previously hidden link embeds to not be hidden anymore.
Therefore, this requires the MessageFlags.SuppressEmbeds to be set.
Other context
My personal use case is logging member nicknames. I noticed that a member had called themselves </:/:> while the message from the bot displayed their nickname as /:/: without the angled brackets.
Which application or package is this feature request for?
formatters
Feature
There's currently many Discord-flavored markdown sequences that can be escaped by the formatters
@discordjs/formatters
package. However, there's one sequence that's not supported yet: the "hide link embed" sequence.This causes strings, such as
<a:/b>
to be rendered asa:/b
by the Discord client. The same goes for the intended purpose, of this sequence:<https://discord.js.org/>
renders ashttps://discord.js.org/
.Escaping this sequence would cause text to render correctly.
Ideal solution or implementation
I propose a sophisticated approach to escape any occurrence of the pattern
/<[^<>\s:]+:\/[^<>\s]+>/g
by surrounding it between\<
and>
.E.g. escaping
<https://discord.js.org/>
would result in the string\<<https://discord.js.org/>>
. This correctly renders as<https://discord.js.org/>
in the Discord client while the link embed remains hidden.Please note that this solution is not yet ideal, since there are very complex interactions between the
<a:/b>
sequence when they're being used in combination with masked links.Alternative solutions or implementations
My original approach was simpler: Escape any occurrence of the character
<
with\<
. This works similar to howescapeStrikethrough()
andescapeSpoiler()
already work. However, this causes previously hidden link embeds to not be hidden anymore. Therefore, this requires theMessageFlags.SuppressEmbeds
to be set.Other context
My personal use case is logging member nicknames. I noticed that a member had called themselves
</:/:>
while the message from the bot displayed their nickname as/:/:
without the angled brackets.Recreation of what it looked like: