This Go module contains two extensions for the Markdown parser Goldmark providing super- and subscripts.
Similar to markdown-it the new markup characters are:
-
The circumflex
^
for superscript -
The tilde
~
for subscript
We need to place one before and one after the text segment like H~2~O
or x^2^
.
No whitespace between the two surrounding markup characters is allowed. This way the common slip using TeX syntax like x^2 + x^5
does not lead to messed up HTML. In case we definitely want to insert space we need to place a non-breaking space—either directly or as the HTML entity
.