Switch branches/tags
Nothing to show
Find file History
Pull request Compare This branch is 2 commits ahead, 273 commits behind angular:master.
Latest commit 3ac89b2 Oct 24, 2018

README.md

angular-html-parser

npm build coverage

A HTML parser extracted from Angular with some modifications

Changelog

Install

# using npm
npm install --save angular-html-parser

# using yarn
yarn add angular-html-parser

Usage

const ngHtmlParser = require('angular-html-parser');

const { rootNodes, errors } = ngHtmlParser.parse('<div>hello world</div>');

API

declare function parse(input: string, options?: Options): ng.ParseTreeResult;

interface Options {
  /** defaults to false */
  canSelfClose?: boolean;
}

Modifications

  • add CDATA node
  • add DocType node
  • add nameSpan field to Element and Attribute
  • add canSelfClose option
  • allow case-insensitive closing tags for non-foreign elements
  • fix Comment#sourceSpan

Development

# build
yarn run build

# test
yarn run test

License

MIT © Ika