本文翻译自:superscript in markdown (Github flavored)?
Following this lead , I tried this in a Github README.md: 在此之后铅 ,我在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? 救命?
#1楼
参考:https://stackoom.com/question/11ai2/降价上标-Github风味
#2楼
Use the <sup></sup> tag ( <sub></sub> is the equivalent for subscripts). 使用<sup></sup>标记( <sub></sub>等同于下标)。 See this gist for an example. 请参阅此要点以获取示例。
#3楼
<sup> and <sub> tags work and are your only good solution for arbitrary text. <sup>和<sub>标签工作,是您任意文本的唯一好方法。 Other solutions include: 其他方案包括:
Unicode 统一
If the superscript (or subscript) you need is of a mathematical nature, Unicode may well have you covered. 如果您需要的上标(或下标)具有数学性质,那么Unicode可能会让您满意。
I've compiled a list of all the Unicode super and subscript characters I could identify in this gist . 我编译了一个列表,列出了我在这个要点中可以识别的所有Unicode超级和下标字符。 Some of the more common/useful ones are: 一些更常见/有用的是:
-
⁰SUPERSCRIPT ZERO (U+2070)⁰ZERO(U + 2070) -
¹SUPERSCRIPT ONE (U+00B9)¹标ONE(U + 00B9) -
²SUPERSCRIPT TWO (U+00B2)²SUPERSCRIPT TWO(U + 00B2) -
³SUPERSCRIPT THREE (U+00B3)³SUPERSCRIPT THREE(U + 00B3) -
ⁿSUPERSCRIPT LATIN SMALL LETTER N (U+207F)ⁿSUPERSCRIPT拉丁小写字母N(U + 207F)
People also often reach for <sup> and <sub> tags in an attempt to render specific symbols like these: 人们也常常寻找<sup>和<sub>标签,试图呈现如下特定符号:
-
™TRADE MARK SIGN (U+2122)™商标标志(U + 2122) -
®REGISTERED SIGN (U+00AE)®注册标志(U + 00AE) -
℠SERVICE MARK (U+2120)℠MARK(U + 2120)
Assuming your editor supports Unicode, you can copy and paste the characters above directly into your document. 假设您的编辑器支持Unicode,您可以将上面的字符直接复制并粘贴到您的文档中。
Alternatively, you could use the hex values above in an HTML character escape . 或者,您可以在HTML字符转义中使用上面的十六进制值。 Eg, ² 例如, ² 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. 这适用于GitHub(并且应该在Markdown呈现为HTML的任何其他位置工作)但在呈现为原始文本/ Markdown时可读性较差。
Images 图片
If your requirements are especially unusual, you can always just inline an image. 如果您的要求特别不寻常,您可以随时只插入图像。 The GitHub supported syntax is: GitHub支持的语法是:

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. 您可以使用完整路径(例如,以https://或http://开头),但通常更容易使用相对路径,该路径将相对于Markdown文档从repo加载图像。
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. 如果您碰巧知道LaTeX (或想要学习它),您可以做任何可以想象的文本操作并将其渲染为图像。 Sites like Quicklatex make this quite easy. 像Quicklatex这样的网站让这很容易。
本文详细介绍了如何在Markdown中正确使用上标和下标,包括使用<sup></sup>和<sub></sub>标签的方法,以及通过Unicode字符实现特殊符号的上标和下标效果。同时,文章还探讨了在特殊需求下使用图像或LaTeX作为解决方案的可能性。
?&spm=1001.2101.3001.5002&articleId=106730340&d=1&t=3&u=88285549354d4236ba5549dcb470fb1b)
5515

被折叠的 条评论
为什么被折叠?



