Is it possible to toggle text to strikethrough text in Visual Studio Code?

11,873

Solution 1

You can make strikethrough in vscode with the help of TODO Highlight extension:

"todohighlight.keywordsPattern": "(~~.+?~~)|(✔.+?\n)|(\\[x\\].+\n)",
"todohighlight.defaultStyle": {
    "color": "none",
    "backgroundColor": "none",
    "textDecoration": "line-through"
},

Use patterns that you usually use for done todos. The above works for such:

[x] done
✔ done
~~done~~

After that you can either use plain typing or find some toggling extension or write one yourself.

Solution 2

Try the extension "Strike for VSCode", looks very lightweight extension.

Highlight the text you want to strikethrough and hit CTRL K + backspace. CTRL K + backspace again to toggle.

Share:
11,873
user1433365
Author by

user1433365

Updated on June 15, 2022

Comments

  • user1433365
    user1433365 almost 2 years

    I want to keep track of a todo list in Visual Studio Code.

    Is it possible to display/toggle strikethrough text:

    • task not yet done
    • ̶t̶a̶s̶k̶ ̶d̶o̶n̶e̶

    (used https://www.piliapp.com/cool-text/strikethrough-text/ for the above).

    Looking for a solution natively or with an extension. The strike-through text needs to be displayed in the text file (like the functioning of org mode in emacs) and not in some output window (like the rendering of a HTML/Latex/MD document).

    Any experts in Visual Studio Code that know if this can be done and how to do it ?

    • Alex
      Alex about 6 years
      Why not use existing extensions like Todo+. They use .todo file extension though, seems more appropriate for a todo list, no?
    • user1433365
      user1433365 about 6 years
      Thanks Alex, this is an interesting suggestion. I m new to Visual Studio Code and currently use moo.do as todo list. As i m spending more and more time in the text editor, I would prefer to have a simple TODO system based on plain txt living in my text editor. I m drawn towards Emacs and org mode or VS Code with a suited extension like the one you suggested. It could work, even if crossing-though a task feels more gratiying to me. My question is also technical. Is it 'uberhaupt' possible to toggle between strike-out and normal text in VS code. How ?
  • Nicholas Humphrey
    Nicholas Humphrey about 4 years
    Dunno why, but Strike actually adds - between the characters, like T-O-D-O.
  • Rajesh
    Rajesh about 3 years
    @NicholasHumphrey You have to enable "strike.whitespace" in Settings>Extensions>Strike> after that it will not have - between white spaces