/discord.format

simple javascript to copy the discord format for texts in chats

Primary LanguageJavaScript

discord.format

How does it work?

The function takes a string as a parameter and uses REGEX to identify and replace substrings under the following conditions:

  • **Text** results in <b>Text</b> --> Text
  • *Text* results in <i>Text</i> --> Text
  • __Text__ results in <u>Text</u> --> insert underlined text here
  • ~~Text~~ results in <s>Text</s> --> Text

The conditions can be combined!