Hotkey for superscript and subscript tags?

Obsidian makes it easy to surround text with quotation marks, bold/italics markdown, and so on. I use the and tags often, and it would be very convenient if there was a hotkey to insert a pair of and tags with the cursor placed in the middle. Is there a way to do that already?

1 Like

My suggestion: plugin Templater + plugin Hotkeys for templates.

  1. Create two templates in the folder defined in Templater settings:
    (for subscript)
    <sub><% tp.file.selection() %></sub>
    (for superscript)
    <sup><% tp.file.selection() %></sup>
  2. With the plugin “Hotkeys for templates” activate each template and then in general Hotkeys search for these two and define your hotkeys
  3. When you need to introduce this tags in your note, just select the text you want inside the tags and use the defined hotkeys.
5 Likes

For this, I am using espanso with the following configuration:

- trigger: ":sub"
    replace: "<sub>$|$</sub>"
    
- trigger: ":sup"
    replace: "<sup>$|$</sup>"
2 Likes

That works like a dream, thank you so much!

Works perfectly! Thanks for sharing!

You could also take a look at the cmenu plugin.

@AllAmericanBreakfast

Another option is the amazing Multi-line formatting plug-in

1 Like

Thanks! I’ll check it out

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.