Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// run any registered "after" plugins
node = after.call(this, node) || node;
return node;
};
/**
* Snapdragon compilers
*/
compiler
/**
* Beginning of string
*/
.set('bos', util.noop)
/**
* Directives and comments
*/
.set('doctype', util.noop)
.set('comment', function(node) {
if (this.options.comments === true) {
this.emit('');
}
})
/**
* Root element
*/
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 = '**';
}
}
if (typeof visitor === 'function') {
visitor.call(this, node, nodes, i);
// allow visitor to override opening tag
if (node.open) {
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 = '**';
}
}
if (typeof visitor === 'function') {
visitor.call(this, node, nodes, i);
// allow visitor to override opening tag
return function(compiler) {
compiler.state.tables = compiler.state.tables || [];
compiler.set('table', function(node) {
if (/]*>/.test(node.html)) {
this.emit('\n', node);
this.emit(node.html);
return;
}
tableize(node);
node.aligmentRow = [];
this.state.tables.push(node);
this.emit('\n\n');
this.mapVisit(node);
this.emit('\n');
});
compiler.set('table.open', util.noop);
compiler.set('table.close', function(node) {
this.state.tables.pop();
});
};
};
* Interactive elements
*/
.set('command', util.noop) //<= WC3 deprecated in favor of <menuitem>
.set('details', block('<details>', '</details>'))
.set('menu', block('', ''))
.set('menuitem', block('', ''))
/**
* Ruby annotation, parenthesis and text (not rendered)
*/
.set('ruby', util.noop)
.set('rb', util.noop)
.set('rp', util.noop)
.set('rt', util.noop)
.set('rtc', util.noop)
/**
* Obsolete, deprecated or other elements we don't want to render
* (please create an issue to discuss if we should reconsider any
* of these, or to let us know if we missed something)
*/
.set('acronym', block('<acronym>', '</acronym>'))
.set('big', util.noop)
.set('data', util.noop)
.set('dialog', util.noop)
.set('math', util.noop)
.set('template', util.noop)
.set('tt', util.noop)
</menuitem>