Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
out(s) {
this.lit(esc(s, false))
}
image(node, entering) {
if (entering) {
if (this.disableTags === 0) {
if (this.options.safe && potentiallyUnsafe(node.destination)) {
this.lit('<_m_.img src="" alt="')
} else {
this.lit('<_m_.img src="' + esc(node.destination, true) +
'" alt="')
}
}
this.disableTags += 1
} else {
this.disableTags -= 1
if (this.disableTags === 0) {
if (node.title) {
this.lit('" title="' + esc(node.title, true))
}
this.lit('" />')
}
}
}
code_block(node) {
let info_words = node.info ? node.info.split(/\s+/) : []
, attrs = this.attrs(node)
if (info_words.length > 0 && info_words[0].length > 0) {
attrs.push([ 'className', 'language-' + esc(info_words[0], true) ])
}
this.cr()
this.tag('_m_.pre')
this.tag('_m_.code', attrs)
this.out(`{\`${node.literal}\`}`)
this.tag('/_m_.code')
this.tag('/_m_.pre')
this.cr()
}
image(node, entering) {
if (entering) {
if (this.disableTags === 0) {
if (this.options.safe && potentiallyUnsafe(node.destination)) {
this.lit('<_m_.img src="" alt="')
} else {
this.lit('<_m_.img src="' + esc(node.destination, true) +
'" alt="')
}
}
this.disableTags += 1
} else {
this.disableTags -= 1
if (this.disableTags === 0) {
if (node.title) {
this.lit('" title="' + esc(node.title, true))
}
this.lit('" />')
}
}
}
link(node, entering) {
let attrs = this.attrs(node)
if (entering) {
if (!(this.options.safe && potentiallyUnsafe(node.destination))) {
attrs.push([ 'href', esc(node.destination, true) ])
}
if (node.title) {
attrs.push([ 'title', esc(node.title, true) ])
}
this.tag('_m_.a', attrs)
} else {
this.tag('/_m_.a')
}
}
link(node, entering) {
let attrs = this.attrs(node)
if (entering) {
if (!(this.options.safe && potentiallyUnsafe(node.destination))) {
attrs.push([ 'href', esc(node.destination, true) ])
}
if (node.title) {
attrs.push([ 'title', esc(node.title, true) ])
}
this.tag('_m_.a', attrs)
} else {
this.tag('/_m_.a')
}
}