src/language-html/preprocess.js
function addIsSpaceSensitive(ast /*, options */) {
  return ast.map(node => {
    if (!node.children) {
      return node;
    }

    if (node.children.length === 0) {
      return node.clone({
        isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode(node)
      });
    }

    return node.clone({
      children: node.children
        .map(child => {
          return Object.assign({}, child, {
            isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode(child),
            isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode(child)
          });
        })
        .map((child, index, children) =>
          Object.assign({}, child, {
            isLeadingSpaceSensitive:
              index === 0
                ? child.isLeadingSpaceSensitive
                : children[index - 1].isTrailingSpaceSensitive &&
                  child.isLeadingSpaceSensitive,
            isTrailingSpaceSensitive:
              index === children.length - 1
                ? child.isTrailingSpaceSensitive
                : children[index + 1].isLeadingSpaceSensitive &&
                  child.isTrailingSpaceSensitive
          })
        )
    });
  });
}
function addIsSpaceSensitive(ast /*, options */) {
  return ast.map(node => {
    if (!node.children) {
      return node;
    }

    if (node.children.length === 0) {
      return node.clone({
        isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode(node)
      });
    }

    return node.clone({
      children: node.children
        .map(child => {
          return Object.assign({}, child, {
            isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode(child),
            isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode(child)
          });
        })
        .map((child, index, children) =>
          Object.assign({}, child, {
            isLeadingSpaceSensitive:
              index === 0
                ? child.isLeadingSpaceSensitive
                : children[index - 1].isTrailingSpaceSensitive &&
                  child.isLeadingSpaceSensitive,
            isTrailingSpaceSensitive:
              index === children.length - 1
                ? child.isTrailingSpaceSensitive
                : children[index + 1].isLeadingSpaceSensitive &&
                  child.isTrailingSpaceSensitive
          })
        )
    });
  });
}
function addIsSpaceSensitive ( ast /*, options */ ) { return ast . map ( node => { if ( ! node . children ) { return node ; } if ( node . children . length === 0 ) { return node . clone ( { isDanglingSpaceSensitive : isDanglingSpaceSensitiveNode ( node ) } ) ; } return node . clone ( { children : node . children . map ( child => { return Object . assign ( { } , child , { isLeadingSpaceSensitive : isLeadingSpaceSensitiveNode ( child ) , isTrailingSpaceSensitive : isTrailingSpaceSensitiveNode ( child ) } ) ; } ) . map ( ( child , index , children ) => Object . assign ( { } , child , { isLeadingSpaceSensitive : index === 0 ? child . isLeadingSpaceSensitive : children [ index - 1 ] . isTrailingSpaceSensitive && child . isLeadingSpaceSensitive , isTrailingSpaceSensitive : index === children . length - 1 ? child . isTrailingSpaceSensitive : children [ index + 1 ] . isLeadingSpaceSensitive && child . isTrailingSpaceSensitive } ) ) } ) ; } ) ; }
- add `isLeadingSpaceSensitive` field
- add `isTrailingSpaceSensitive` field
- add `isDanglingSpaceSensitive` field for parent nodes
- add isLeadingSpaceSensitive field - add isTrailingSpaceSensitive field - add isDanglingSpaceSensitive field for parent nodes