@hegeldev/hegel
    Preparing search index...

    Class Document

    A standalone document laid out by the engine, for printing outside a test: to check what a printWith callback or a generators.PrintableGenerator prints, say. Print into printer, then call finish once to read the result and release the document. A document never finished is released when it is garbage collected.

    const doc = new hegel.Document({ maxWidth: 8 });
    doc.printer.seq("[", "]", [1, 2, 3], (p, n) => p.value(n));
    doc.finish(); // "[\n 1,\n 2,\n 3,\n]"
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    printer: PrettyPrinter

    The printer to write the document's content through.

    Methods

    • Splice in the content of any deferred regions, lay the document out and return it, releasing the document. Call it once.

      Returns string