Comparing version 1.0.12 to 1.0.13
@@ -105,3 +105,3 @@ 'use strict' | ||
case 'text': { | ||
return this.renderer.text(this.token.text) | ||
return this.renderer.paragraph(this.parseText()) | ||
} | ||
@@ -129,2 +129,11 @@ case 'list_start': { | ||
} | ||
case 'loose_item_start': { | ||
let body = '' | ||
while(this.next().type !== 'list_item_end') { | ||
body += this.tok() | ||
} | ||
return this.renderer.listitem(body) | ||
} | ||
} | ||
@@ -139,6 +148,9 @@ } | ||
let inline = { | ||
escape: /^\\[\\`*{}\[\]()#+\-.!_>]/, | ||
link: /^!?\[(inside)\]\(href\)/, | ||
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, | ||
autolink: /^<([^ >]+(:\/|@)[^ >]+)>/, | ||
code: /^(`+)\s*([\s\S]+?[^`])\s*\1(?!`)/, | ||
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/ | ||
text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/, | ||
strong: /^__([\s\S]+?)__(?!__)|^\*\*([\s\S]+?)\*\*(?!\*)/, | ||
em: /^\b_((?:\\_|[^_]|__)+?)_\b|\*((?:\\\*|[^\*]|\*\*)+?)\*/ | ||
} | ||
@@ -183,2 +195,18 @@ inline._inside = /.*?/ | ||
if(cap = this.rules.strong.exec(src)) { | ||
debugger | ||
src = src.substring(cap[0].length) | ||
out += this.renderer.strong(this.output(cap[2] || cap[1])) | ||
continue | ||
} | ||
if(cap = this.rules.em.exec(src)) { | ||
debugger | ||
src = src.substring(cap[0].length) | ||
out += this.renderer.em(this.output(cap[1] || cap[2])) | ||
} | ||
if(cap = this.rules.autolink.exec(src)) { | ||
@@ -298,3 +326,5 @@ src = src.substring(cap[0].length) | ||
+ ' id="' | ||
+ id.replace(/ +?[^ ]/g, this.options.gap) | ||
// 这里的替换不能把不是空格的字符也捕获 | ||
// + id.replace(/ +?[^ ]/g, this.options.gap) ✖️ | ||
+ id.replace(/ +?(?! )/g, this.options.gap) // ✔️ | ||
+ '">' | ||
@@ -313,2 +343,14 @@ + text | ||
strong(text) { | ||
return '<strong>' | ||
+ text | ||
+ '</strong>' | ||
} | ||
em(text) { | ||
return '<em>' | ||
+ text | ||
+ '</em>' | ||
} | ||
link(href, title, text) { | ||
@@ -315,0 +357,0 @@ let out = '<a href="' + href + '"' |
{ | ||
"name": "cmarked", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "更符合汉语的markdown编译器", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -86,3 +86,8 @@ # cmarked | ||
目前该JavaScript包处于开发阶段,只在我的博客网站上面进行试用<http://www.jiangxuan.org> | ||
如果你是开发者,请阅读dev.md | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32261
11
924
93