Skip to content

Instantly share code, notes, and snippets.

@billmei
Last active March 31, 2021 09:11
Show Gist options
  • Save billmei/8856977 to your computer and use it in GitHub Desktop.
Save billmei/8856977 to your computer and use it in GitHub Desktop.
Adds unicode strikethrough characters to your input so that you can post it to comment boxes and social media websites (Facebook, Twitter, etc.) that don't accept HTML tags
const strikethroughText = text =>
text.split('').reduce((acc, char) =>
acc + char + '\u0335', '')
// strikethroughText("amazingly few discotheques provide jukeboxes")
// "a̵m̵a̵z̵i̵n̵g̵l̵y̵ ̵f̵e̵w̵ ̵d̵i̵s̵c̵o̵t̵h̵e̵q̵u̵e̵s̵ ̵p̵r̵o̵v̵i̵d̵e̵ ̵j̵u̵k̵e̵b̵o̵x̵e̵s̵"
@arthurvanderwal81
Copy link

Many thanks for this helpful script - I changed the unicode \u336 to \u335 to have strikethrough for google chrome notifications

@billmei
Copy link
Author

billmei commented Sep 1, 2020

@arthurvanderwal81 Thanks for the tip! I suppose I'll update this to ES6 while I'm at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment