降价上标(Github风味)?

本文详细介绍了如何在Markdown中正确使用上标和下标,包括使用<sup></sup>和<sub></sub>标签的方法,以及通过Unicode字符实现特殊符号的上标和下标效果。同时,文章还探讨了在特殊需求下使用图像或LaTeX作为解决方案的可能性。

本文翻译自: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, &#x00B2; 例如, &#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. 这适用于GitHub(并且应该在Markdown呈现为HTML的任何其他位置工作)但在呈现为原始文本/ Markdown时可读性较差。

Images 图片

If your requirements are especially unusual, you can always just inline an image. 如果您的要求特别不寻常,您可以随时只插入图像。 The GitHub supported syntax is: GitHub支持的语法是:

![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. 您可以使用完整路径(例如,以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这样的网站让这很容易。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值