Function serializeOuter

  • Serializes an AST element node to an HTML string, including the element node.

    Type Parameters

    Parameters

    Returns string

    const parse5 = require('parse5');

    const document = parse5.parseFragment('<div>Hello, <b>world</b>!</div>');

    // Serializes the <div> element.
    const str = parse5.serializeOuter(document.childNodes[0]);

    console.log(str); //> '<div>Hello, <b>world</b>!</div>'