Socket
Socket
Sign inDemoInstall

angular-html-parser

Package Overview
Dependencies
1
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-html-parser

A HTML parser extracted from Angular with some modifications


Version published
Maintainers
4
Install size
349 kB
Created

Changelog

Source

15.0.1 (2022-11-22)

common

| Commit | Type | Description | | -- | -- | -- | | 930af9dd26 | fix | Fix MockPlatformLocation events and missing onPopState implementation (#48113) |

forms

| Commit | Type | Description | | -- | -- | -- | | b342e55509 | fix | don't mutate validators array (#47830) | | a12a120272 | fix | FormBuilder.group return right type with shorthand parameters. (#48084) |

language-service

| Commit | Type | Description | | -- | -- | -- | | cc8b76ef7c | fix | correctly handle host directive inputs/outputs (#48147) | | a8c33bf931 | fix | update packages/language-service/build.sh script to work with vscode-ng-language-service's new Bazel build (#48120) |

router

| Commit | Type | Description | | -- | -- | -- | | e4309d57d8 | fix | correct type of nextState parameter in canDeactivate (#48038) | | 9baefd085f | fix | Ensure renavigating in component init works with enabledBlocking (#48063) | | fa5528fb5f | fix | restore 'history.state' on popstate even if navigationId missing (#48033) |

Special Thanks

Alan Agius, Andrew Scott, Bjarki, Bob Watson, Brooke, Derek Cormier, Dylan Hunn, George Kalpakas, Greg Magolan, Ikko Ashimine, Ivan Rodriguez, Jessica Janiuk, Joe Roxbury, Joey Perrott, Kristiyan Kostadinov, Matthieu Riegler, Mikhail Savchuk, Nebojsa Cvetkovic, Pawel Kozlowski, Volodymyr and Wooshaah

<!-- CHANGELOG SPLIT MARKER -->

<a name="12.2.17"></a>

Readme

Source

angular-html-parser

npm

An 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

import {parse} from 'angular-html-parser';

const {rootNodes, errors} = parse(`
<!DOCTYPE html>
<html>
  <head>
    <title>Hello world!</title>
  </head>
  <body>
    <div>Hello world!</div>
  </body>
</html>
`);

API

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

interface Options {
  /**
   * any element can self close
   *
   * defaults to false
   */
  canSelfClose?: boolean;
  /**
   * support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`)
   *
   * defaults to false
   */
  allowHtmComponentClosingTags?: boolean;
  /**
   * do not lowercase tag names before querying their tag definitions
   *
   * defaults to false
   */
  isTagNameCaseSensitive?: boolean;
  /**
   * customize tag content type
   *
   * defaults to the content type defined in the HTML spec
   */
  getTagContentType?: (
    tagName: string,
    prefix: string,
    hasParent: boolean,
    attrs: Array<{prefix: string; name: string; value?: string | undefined}>
  ) => void | ng.TagContentType;
  /**
   * tokenize angular control flow block syntax
   */
  tokenizeAngularBlocks?: boolean,
}

Modifications

  • add CDATA node
  • add DocType node
  • add nameSpan field to Element and Attribute
  • allow case-insensitive closing tags for non-foreign elements
  • fix Comment#sourceSpan
  • support bogus comments (<!...>, <?...>)
  • support full named entities (fixed upstream)
  • add type property to nodes
  • value span for attributes includes quotes

Development

# build
yarn run build

# test
yarn run test

License

MIT © Ika

FAQs

Last updated on 29 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc