JSPM

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

HTML parser for rehype

Package Exports

  • rehype-parse

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 (rehype-parse) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rehype-parse Build Status Coverage Status Chat

Parser for unified. Parses HTML to a hast syntax tree. Used in the rehype processor.

Installation

npm:

npm install rehype-parse

Usage

var unified = require('unified');
var parse = require('rehype-parse');
var stringify = require('rehype-stringify');

process.stdin
  .pipe(unified())
  .use(parse)
  .use(stringify)
  .pipe(process.stdout);

API

processor.use(parse)

Configure the processor to read HTML as input and process an hast syntax tree.

options
options.fragment

Specify whether to parse a fragment (boolean, default: false), instead of a complete document. In document mode, unopened html, head, and body elements are opened in just the right places.

options.verbose

Patch extra positional information (boolean, default: false). If specified, the following element:

<img src="#" alt>

...has the following data:

{ position:
   { opening:
      { start: { line: 1, column: 1, offset: 0 },
        end: { line: 1, column: 18, offset: 17 } },
     closing: null,
     properties:
      { src:
         { start: { line: 1, column: 6, offset: 5 },
           end: { line: 1, column: 13, offset: 12 } },
        alt:
         { start: { line: 1, column: 14, offset: 13 },
           end: { line: 1, column: 17, offset: 16 } } } } }

parse.Parser

Access to the parser, if you need it.

License

MIT © Titus Wormer