micromark-extension-gfm-tagfilter
Advanced tools
Comparing version 0.2.0 to 0.3.0
39
html.js
@@ -1,9 +0,4 @@ | ||
exports.enter = { | ||
htmlFlow: enterHtmlFlowWithTagFilter, | ||
htmlText: enterHtmlTextWithTagFilter | ||
} | ||
exports.exit = { | ||
htmlFlow: exitHtml, | ||
htmlText: exitHtml, | ||
data: exitData | ||
htmlFlowData: exitHtmlFlowData, | ||
htmlTextData: exitHtmlTextData | ||
} | ||
@@ -18,32 +13,14 @@ | ||
function enterHtmlFlowWithTagFilter() { | ||
this.lineEndingIfNeeded() | ||
this.setData('insideHtmlFlow', true) | ||
if (this.options.allowDangerousHtml) { | ||
this.setData('ignoreEncode', true) | ||
} | ||
function exitHtmlFlowData(token) { | ||
exitHtmlData.call(this, token, reFlow) | ||
} | ||
function enterHtmlTextWithTagFilter() { | ||
this.setData('insideHtmlText', true) | ||
if (this.options.allowDangerousHtml) { | ||
this.setData('ignoreEncode', true) | ||
} | ||
function exitHtmlTextData(token) { | ||
exitHtmlData.call(this, token, reText) | ||
} | ||
function exitHtml() { | ||
this.setData('ignoreEncode') | ||
this.setData('insideHtmlFlow') | ||
this.setData('insideHtmlText') | ||
} | ||
function exitData(token) { | ||
function exitHtmlData(token, filter) { | ||
var value = this.sliceSerialize(token) | ||
var filter = this.getData('insideHtmlFlow') | ||
? reFlow | ||
: this.getData('insideHtmlText') | ||
? reText | ||
: undefined | ||
if (filter && this.options.allowDangerousHtml) { | ||
if (this.options.allowDangerousHtml) { | ||
value = value.replace(filter, '<$1$2') | ||
@@ -50,0 +27,0 @@ } |
{ | ||
"name": "micromark-extension-gfm-tagfilter", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "micromark extension to support GFM tagfilter", | ||
@@ -34,3 +34,3 @@ "license": "MIT", | ||
"devDependencies": { | ||
"micromark": "~2.5.0", | ||
"micromark": "~2.6.0", | ||
"nyc": "^15.0.0", | ||
@@ -37,0 +37,0 @@ "prettier": "^2.0.0", |
7113
24