Method for automatically closing sub/superscripts?

I posted about this on the subreddit, but figured that I would try reaching out here as well.

I am looking to find either a setting/method/plug-in that automatically closes subscripts and superscripts.

For example, when writing subscripts I’d like to type (without the spaces):

< sub >

and then have the program automatically append:

< /sub >

to the right of my cursor so that I can continue typing what I am subscript-ing.

This might be more complicated to implement than I am imagining, but the program already automatically appends quotes and parentheses after the opening symbol, seems like a logical extension of the functionality to me.

I am new to markdown, so apologies if this is a well established function (or lack thereof).

I have looked around here on the forum, as well as done some exploratory Googleing, but found nothing.

Thanks in advance for any advice!

It’s not built-in to auto-close HTML tags, but you can use the Text Snippets plugin.

I have, for instance, these text snippets defined:

kbd : <kbd>$end$</kbd>
sup : <sup>$end$</sup>
sub : <sub>$end$</sub>

This allows me to type sub, press the defined expansion key, and voilà, it will insert <sub>|</sub> and place the cursor where I put the | here.

That’s perfect. Thank you for the recommendation!

1 Like

Happy to help, glad you can use it!

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