How to use the snapdragon-util.isInside 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 = '**';
      }
    }

    if (typeof visitor === 'function') {
      visitor.call(this, node, nodes, i);

      // allow visitor to override opening tag
      if (node.open) {
        open = node.open;
      }
    }

    if (!/^(sup|sub)$/.test(node.type) && /[a-z0-9]/i.test(this.output.slice(-1))) {
github breakdance / breakdance / lib / compiler.js View on Github external
compiler.isInside = function(node, types) {
      return util.isInside(this.state, node, types);
    };