Add an Obsidian command for ‘toggle strikethrough for selection'

I frequently use the bold and italics hotkeys, but I’d really also like to see a strikethrough hotkey. When editing I strikethrough multiple lines of text. To do this currently I need to add ~~ to both the start and end of end of the text selection. A hotkey would speed up this process substantially. :slight_smile:

22 Likes

This seems like such an obvious hotkey that should be available eh

4 Likes

+1 from me

2 Likes

Yes, please, please, and please!

This could be done by AutoHotkey or Keyboard Maestro for many applications at once, including Obsidian. Or as a plugin for Obsidian only.

Procedure to execute on custom hotkey might be the following:

  • cut selection from Obsidian
  • parse to separate text from e.g. list item markers and block-id
  • prefix and suffix the text by desired markup
  • concatenate parsed pieces back together
  • paste back into Obsidian

I think the technically correct feature request would be: “Add an Obsidian command for ‘toggle strikethrough for selection’”. This is how there are assignable hotkeys for bold and italic currently.

Just so everyone knows, an excellent workaround is to toggle on “Autopair markdown syntax” in Editor settings. Then you can select the text you want to strikethrough and tap ~ twice for the desired outcome.

A hotkey would save an additional one keypress of time.

5 Likes

It ↑ really works. So I would just update description in settings from
Pair symbols automatically for bold and italic.
to
Pair symbols automatically for bold, italic, ...

Which would loosely indicate it supports more symbols. Precise range of autopaired markdown syntax can be specified in up to date documentation.

Hotkey would not even save a keypress unless it is: Single key hotkeys (context sensitive)

Thanks for the suggestion! :slight_smile:

I submitted a report to update that description text, as you suggested:

1 Like

Hi,
Nice idea, but it doesn’t work on Mac OSX (related post ~~ of selected text replaces the text rather than formats as strikethrough).
I have exactly the same problem with Mac OS 11.2.2 et Obsidian 0.11.3.
So this feature is needed!

I’m on MacOS as well. Do you have “Autopair markdown syntax” in Editor settings turned on? It should work. If not, something else might be going wrong and you should post in the Help forum. A good way to debug is to open the Help vault and try it in there, free of plugins.

Thanks dsteinbock for the piece of advice.
I just tried in the Help vault and observed the same problem: the selected content is replaced by two ~~ and that is it.
I will prepare a post in the Help forum.

+1 from me as well. Would be a very useful feature and makes the UX more consistent since highlight toggle already exists

It’d be great to have hotkeys/easy selections for not just bold and italics, but as mentioned strike-through and I’d add both sub and super scripts…

For adding italics, bold, highlights and strikethrough to selected text, enabling “Auto pair Markdown syntax” works great here. I’d still love to see commands/hotkeys for toggling all of these, since removing them is awkward: You have to manually go to the beginnings and endings of the selected text to remove the strikethrough codes. (We do already have commands for toggling bold, italic and highlight.)

I’m on mac and this works for me without highlighting the text. Just add the “~~” before (to left of) the text and it works on lists and normal text.

The trick with “~~” does not work for multiline selection.

It seems that this has been supported in v0.12.15 of Obsidian, if you search for “strikethrough” in the Hotkeys part of the configuration pane.