How to create superscript text in GitHub markdown files?

I’m trying to add superscript formatting to text in my GitHub README file but having trouble getting it to work properly. I found some suggestions online about using HTML span tags with CSS styling but when I try it the text just shows up as regular text instead of being raised above the baseline.

<span style="vertical-align: baseline; position: relative; top: -0.4em;">raised text here</span>

The formatting doesn’t seem to take effect in GitHub’s markdown renderer. Is there a different way to make superscript text work in GitHub flavored markdown? I need this for mathematical expressions and citations in my documentation. Any working solutions would be helpful.

hey, yeah, github markdown doesn’t support that css stuff. just go with <sup> tags, like <sup>2</sup>. works great for superscripts! also, if it’s just numbers, you can use the unicode characters ² and ³ instead. hope that helps!

github’s markdown renderer is pretty strict with HTML. the usual <sup> should do the trick for most cases. if you got a lot of math stuff, maybe consider using ‘.md’ files with kaTeX or MathJax locally and convert them to HTML later!

The <sup> tag works for basic stuff, but it’s a pain when you’ve got tons of docs that need consistent formatting across different platforms.

I hit this same issue managing docs for multiple repos. Instead of adding HTML tags everywhere by hand, I built an automated workflow that processes markdown files before they reach GitHub.

I use Latenode to monitor my docs folder and auto-convert syntax like ^superscript^ into proper HTML tags. It triggers on every push, processes all markdown files, and handles conversion automatically.

Now I write clean markdown locally but still get proper superscripts on GitHub. Works for subscripts, math notation, and other formatting GitHub doesn’t support.

The automation also checks that citations and math expressions are formatted correctly before going live. Saves me hours compared to manually editing HTML in every file.

GitHub strips custom CSS, so your span won’t work. Just use <sup> tags - they’re the most reliable option for superscript in GitHub markdown. I’ve used them for years in project docs and they work great across all GitHub interfaces, including mobile. For math expressions, try GitHub’s LaTeX support with $ delimiters instead. It handles complex formulas with multiple superscripts way better than HTML tags. One heads up: <sup> can mess with line spacing in dense text, so I add extra spacing around those paragraphs.

Your HTML approach failed because GitHub sanitizes inline styles for security. While others have suggested <sup> tags, another option is the use of Unicode superscript characters. You can directly insert characters like ⁰¹²³⁴⁵⁶⁷⁸⁹ in your documents without relying on HTML. I find these handy for footnotes and basic math in my markdown files. However, be aware that the selection of Unicode characters is limited to numerals and a few letters such as ᵃᵇᶜᵈᵉ. For more complex notations, you’ll have to revert to using <sup> tags. Nonetheless, Unicode superscripts are versatile and work seamlessly in plain text environments where HTML is unsupported.