|
@ -5,7 +5,6 @@ |
|
|
|
|
|
|
|
|
var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE; |
|
|
var HTML_TAG_RE = require('../common/html_re').HTML_TAG_RE; |
|
|
|
|
|
|
|
|
var COMMENT_RE = /^<!--[\s\S]*?-->$/; |
|
|
|
|
|
|
|
|
|
|
|
function isLetter(ch) { |
|
|
function isLetter(ch) { |
|
|
/*eslint no-bitwise:0*/ |
|
|
/*eslint no-bitwise:0*/ |
|
@ -15,7 +14,7 @@ function isLetter(ch) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function html_inline(state, silent) { |
|
|
module.exports = function html_inline(state, silent) { |
|
|
var ch, match, max, content, pos = state.pos; |
|
|
var ch, match, max, pos = state.pos; |
|
|
|
|
|
|
|
|
if (!state.md.options.html) { return false; } |
|
|
if (!state.md.options.html) { return false; } |
|
|
|
|
|
|
|
@ -38,17 +37,10 @@ module.exports = function html_inline(state, silent) { |
|
|
match = state.src.slice(pos).match(HTML_TAG_RE); |
|
|
match = state.src.slice(pos).match(HTML_TAG_RE); |
|
|
if (!match) { return false; } |
|
|
if (!match) { return false; } |
|
|
|
|
|
|
|
|
content = state.src.slice(pos, pos + match[0].length); |
|
|
|
|
|
|
|
|
|
|
|
// Additional check for comments
|
|
|
|
|
|
if (COMMENT_RE.test(content)) { |
|
|
|
|
|
if (/(^>|^->|--|-$)/.test(content.slice(4, -3))) { return false; } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!silent) { |
|
|
if (!silent) { |
|
|
state.push({ |
|
|
state.push({ |
|
|
type: 'html_inline', |
|
|
type: 'html_inline', |
|
|
content: content, |
|
|
content: state.src.slice(pos, pos + match[0].length), |
|
|
level: state.level |
|
|
level: state.level |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|