JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3925721
  • Score
    100M100P100Q236223F
  • License MIT

Transform HAST to Parse5’s AST

Package Exports

  • hast-util-to-parse5

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hast-util-to-parse5) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hast-util-to-parse5 Build Status Coverage Status

Transform HAST to Parse5’s AST.

Why not use an adapter? Because it’s more code weight to use adapters, and much more fragile.

Installation

npm:

npm install hast-util-to-parse5

Usage

Dependencies:

var toParse5 = require('hast-util-to-parse5');

Fixture:

var ast = toParse5({
  type: 'element',
  tagName: 'h1',
  properties: {},
  children: [{type: 'text', value: 'World!'}]
});

Yields:

{ nodeName: 'h1',
  tagName: 'h1',
  attrs: [],
  namespaceURI: 'http://www.w3.org/1999/xhtml',
  childNodes: [ { nodeName: '#text', value: 'World!', parentNode: [Circular] } ] }

API

toParse5(node)

Transform a HAST Node to an ASTNode according to the default Parse5 adapter.

License

MIT © Titus Wormer