Socket
Socket
Sign inDemoInstall

@lezer/html

Package Overview
Dependencies
3
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lezer/html

lezer-based HTML grammar


Version published
Weekly downloads
300K
decreased by-7.46%
Maintainers
1
Install size
582 kB
Created
Weekly downloads
 

Changelog

Source

1.3.9 (2024-02-21)

Bug fixes

When using the "selfClosing" dialect, fix parse errors for <br/> (tags that implicitly self-close) and <script/> (special tags).

Readme

Source

@lezer/html

This is an HTML grammar for the lezer parser system.

The code is licensed under an MIT license.

Interface

This package exports two bindings:

parser: Parser

The parser instance for the basic HTML grammar. Supports two dialects:

  • "noMatch" turns off tag matching, creating regular syntax nodes even for mismatched tags.

  • "selfClosing" adds support for /> self-closing tag syntax.

configureNesting(tags?: {
  tag: string,
  attrs?: (attrs: {[attr: string]: string}) => boolean,
  parser: Parser,
}[], attributes?: {
  name: string,
  tagName?: string,
  parser: Parser,
}[]): ParseWrapper

Create a nested parser config object which overrides the way the content of some tags or attributes is parsed. Each tag override is an object with a tag property holding the (lower case) tag name to override, and an optional attrs predicate that, if given, has to return true for the tag's attributes for this override to apply.

The parser property describes the way the tag's content is parsed.

FAQs

Last updated on 21 Feb 2024

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