Skip to content

Commit 5fbde08

Browse files
ydfzgyjlinhe0x0
authored andcommitted
修改 Markdown 解析代码以支持 sup 标签 (xitu#69)
1 parent 868de27 commit 5fbde08

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

site/_core/Marked.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ var inline = {
450450
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
451451
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
452452
url: noop,
453+
sup: /^<sup>([\s\S]+?)<\/sup>/,
453454
tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
454455
link: /^!?\[(inside)\]\(href\)/,
455456
reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
@@ -596,6 +597,13 @@ InlineLexer.prototype.output = function(src) {
596597
continue;
597598
}
598599

600+
// sup
601+
if (cap = this.rules.sup.exec(src)) {
602+
src = src.substring(cap[0].length);
603+
out.push(React.DOM.sup(null, this.output(cap[2] || cap[1])));
604+
continue;
605+
}
606+
599607
// tag
600608
if (cap = this.rules.tag.exec(src)) {
601609
src = src.substring(cap[0].length);

0 commit comments

Comments
 (0)