How to use hast-util-to-dom - 1 common examples

To help you get started, we’ve selected a few hast-util-to-dom 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 rehypejs / rehype-dom / packages / rehype-dom-stringify / src / index.js View on Github external
function compiler(tree) {
    const node = toDOM(tree, settings);
    const serialized = new XMLSerializer().serializeToString(node);

    // XMLSerializer puts xmlns on root elements (typically the document
    // element, but in case of a fragment all of the fragments children).
    // We’re using the DOM, and we focus on HTML, so we can always remove HTML
    // XMLNS attributes (HTML inside SVG does not need to have an XMLNS).
    return serialized.replace(htmlXmlnsExpression, '');
  }
}

hast-util-to-dom

hast utility to transform to the DOM

ISC
Latest version published 9 months ago

Package Health Score

62 / 100
Full package analysis

Popular hast-util-to-dom functions