How to use the snapdragon-util.isEmptyNodes function in snapdragon-util

To help you get started, we’ve selected a few snapdragon-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github breakdance / breakdance / lib / utils.js View on Github external
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 = '**';
      }
github breakdance / breakdance / lib / compiler.js View on Github external
.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', {});
github breakdance / breakdance / lib / utils.js View on Github external
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);
  };
};