MarkdownNodeArray

Reference

This is an extension of the NodeArray class but with some helper methods

Usage


const nodes = new MarkdownNodeArray()

nodes.push(
    new MarkdownNode(),
    new MarkdownNode(),
    new MarkdownNode(),
)

const html = nodes.toHtml()

Properties

setPositions

  • Type: function

Update nodes start and end positions

It also handle the children nodes

nodes.setPositions() // same as nodes.forEach((node) => node.setPositions())

toHtml

  • Type: function

Convert all nodes to Html

It also handle the children nodes

nodes.toHtml() // same as nodes.map((node) => node.toHtml()).join('')