Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superscript in markdown (Github flavored)?

Following this lead, I tried this in a Github README.md:

<span style="vertical-align: baseline; position: relative;top: -0.5em;>text in superscript</span> 

Does not work, the text appears as normal. Help?

like image 735
seinecle Avatar asked Mar 01 '13 10:03

seinecle


People also ask

How do I superscript in GitHub markdown?

In LaTeX you indicate superscript with the ^ and subscript with _ . Curly braces ( { and } ) can be used to group characters. You also need to escape spaces with a backslash.

How do you add a superscript in markdown?

Subscripts and Superscripts To indicate a subscript, use the underscore _ character. To indicate a superscript, use a single caret character ^ . Note: this can be confusing, because the R Markdown language delimits superscripts with two carets.

What GitHub Flavored Markdown is and how it is used?

GitHub Flavored Markdown, often shortened as GFM, is the dialect of Markdown that is currently supported for user content on GitHub.com and GitHub Enterprise. This formal specification, based on the CommonMark Spec, defines the syntax and semantics of this dialect. GFM is a strict superset of CommonMark.


Video Answer


2 Answers

Use the <sup></sup>tag (<sub></sub> is the equivalent for subscripts). See this gist for an example.

like image 76
Michael Wild Avatar answered Sep 23 '22 17:09

Michael Wild


<sup> and <sub> tags work and are your only good solution for arbitrary text. Other solutions include:

Unicode

If the superscript (or subscript) you need is of a mathematical nature, Unicode may well have you covered.

I've compiled a list of all the Unicode super and subscript characters I could identify in this gist. Some of the more common/useful ones are:

  • SUPERSCRIPT ZERO (U+2070)
  • ¹ SUPERSCRIPT ONE (U+00B9)
  • ² SUPERSCRIPT TWO (U+00B2)
  • ³ SUPERSCRIPT THREE (U+00B3)
  • SUPERSCRIPT LATIN SMALL LETTER N (U+207F)

People also often reach for <sup> and <sub> tags in an attempt to render specific symbols like these:

  • TRADE MARK SIGN (U+2122)
  • ® REGISTERED SIGN (U+00AE)
  • SERVICE MARK (U+2120)

Assuming your editor supports Unicode, you can copy and paste the characters above directly into your document.

Alternatively, you could use the hex values above in an HTML character escape. Eg, &#x00B2; instead of ². This works with GitHub (and should work anywhere else your Markdown is rendered to HTML) but is less readable when presented as raw text/Markdown.

Images

If your requirements are especially unusual, you can always just inline an image. The GitHub supported syntax is:

![Alt text goes here, if you'd like](path/to/image.png)  

You can use a full path (eg. starting with https:// or http://) but it's often easier to use a relative path, which will load the image from the repo, relative to the Markdown document.

If you happen to know LaTeX (or want to learn it) you could do just about any text manipulation imaginable and render it to an image. Sites like Quicklatex make this quite easy.

like image 45
Molomby Avatar answered Sep 23 '22 17:09

Molomby