/* Code-Comments */

Superscript And Subscript With Markdown

August 09, 2019

Markdown doesn’t support for superscript or subscript directly. However, there are multiple strategies to adding superscript and subscript to your markdown.

The simplest, and the way I’d been doing it for months, is to use character itself. For example, using the Emoji keyboard on a Mac (or a symbol keyboard in Windows), you can insert the character you want manually.1 It’s a valid character and so Markdown will honor it.

When writing for the web, however, it’s also possible to use a markdown compiler. Examples of compilers include Remark and Liquid. The will compile the markdown into HTML, which means that valid HTML within the body of the file will be respected.

This is powerful because it allows the blending of Markdown and HTML - which in my case means that I can use a <sup> tag to easily add words in superscript without needing to select the characters one at a time from a symbols keyboard.

This may not look as pretty as a the actual superscript / subscript when looking at the markdown, but it is mighty handy.

H/t to Sung Kim (again) for asking the question and pushing me to find a better solution.2

Footnotes


Stephen Weiss

Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!