Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function(node, nodes, i) {
if (util.isEmptyNodes(node, open)) return;
var state = this.state;
var type = node.type;
var isVoid = isSelfClosing(node.type);
if (!isVoid && !this.compilers.hasOwnProperty(type + '.open')) {
this.set(type + '.open', util.noop);
this.set(type + '.close', util.noop);
}
// convert headings to bold see: edge-cases.md - headings #1
if (/^h[1-6]$/.test(type)) {
if (util.isInside(state, node, ['a', 'li', 'table'])) {
node.type = 'strong';
open = '**';
close = '**';
}
.set('code', function(node) {
if (util.isEmptyNodes(node)) {
adjustTrailingSpace(this);
return;
}
node.delim = /`/.test(node.text) ? '``' : '`';
if (node.html) {
var type = node.parent.type;
node.lang = type === 'pre' ? utils.getLang(node.attribs) : '';
var text = {type: 'text', val: unescape(node.html)};
if (node.lang) {
text.val = node.text;
}
define(text, 'parent', node);
define(text, 'prev', {});
define(text, 'next', {});
return function(node) {
if (this.options.whitespace === false) {
return this.mapVisit(node);
}
if (util.isEmptyNodes(node, openTag)) return;
if (/(^|\w)$/.test(this.output)) this.emit(' ');
this.mapVisit(node);
};
};