怎么在markdown中使用上标、下标?

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_40147863/article/details/82014166

怎么在markdown中使用上标、下标

markdown中如何加入上标、下标? 如指数,下标,商标等等。

解决方法

Markdown一个套兼容HTML的语法,所以使用HTML中下标下标的语法即可。

写法

X<sub>i</sub>
H<sub>2</sub>O  CO<sub>2</sub>
益达<sup>TM</sup>

效果

Xi
H2O CO2
益达TM

展开阅读全文

上标换为“#+”,下标换为“#-”’”

04-01

新鲜出炉的一段代码,憋了三天。rn主要作用就是将excel中“上标“”换为"#+..#="rn分享一下 rnrn[code=vb]Function subscr(rng As Range)rnDim LengthS As IntegerrnLengthS = Len(rng)rnDim i As IntegerrnDim str As Stringrnrnrn For i = 1 To LengthSrnrn Dim lengt As Integer: lengt = 1rn If rng.Characters(Start:=i, Length:=1).Font.Subscript = True Then '下标rn lengt = SubLengthfromI(rng, i + 1, "Subscript") - irn str = rng.Characters(Start:=i, Length:=lengt).Captionrn str = "#-" & str & "#="rn subscr = subscr & strrn ElseIf rng.Characters(Start:=i, Length:=1).Font.Superscript = True Then '上标rn lengt = SubLengthfromI(rng, i + 1, "Superscript") - irn str = rng.Characters(Start:=i, Length:=lengt).Captionrn str = "#+" & str & "#="rn subscr = subscr & strrn Else '正常rn str = rng.Characters(Start:=i, Length:=1).Captionrn str = strrn subscr = subscr & strrn End Ifrnrn i = i + lengt - 1rnrn NextrnrnEnd FunctionrnrnFunction SubLengthfromI(rng As Range, i As Integer, item As String) As Integerrnrn If i > Len(rng) Then SubLengthfromI = i: Exit Functionrn If item = "Subscript" Thenrn If rng.Characters(Start:=i, Length:=1).Font.Subscript = True Thenrn i = i + 1rn Call SubLengthfromI(rng, i, "Subscript")rnrn End Ifrn ElseIf item = "Superscript" Thenrn If rng.Characters(Start:=i, Length:=1).Font.Superscript = True Thenrn i = i + 1rn Call SubLengthfromI(rng, i, "Superscript")rn End Ifrn Elsern MsgBox "neither sub or scr,what are you doing?"rn End Ifrnrn SubLengthfromI = irnEnd Functionrn[/code] 论坛

没有更多推荐了,返回首页