Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html-parse-stringify

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-parse-stringify

Parses well-formed HTML (meaning all tags closed) into an AST and back. quickly.

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.6M
increased by7.01%
Maintainers
4
Weekly downloads
 
Created

What is html-parse-stringify?

The html-parse-stringify npm package is a lightweight tool for parsing HTML into AST (Abstract Syntax Tree) and vice versa, i.e., stringifying AST back into HTML. It is particularly useful for tasks where you need to manipulate or analyze HTML structures programmatically without the overhead of a full DOM parser.

What are html-parse-stringify's main functionalities?

Parsing HTML to AST

This feature allows you to convert an HTML string into a structured AST, which can be easily manipulated or analyzed in JavaScript.

const htmlParseStringify = require('html-parse-stringify');
const ast = htmlParseStringify.parse('<div>Hello, <strong>world!</strong></div>');

Stringifying AST to HTML

This feature enables you to take an AST and convert it back into an HTML string. This is useful when you have manipulated the AST and want to generate the updated HTML.

const htmlParseStringify = require('html-parse-stringify');
const ast = [{ tag: 'div', attrs: {}, children: [{ text: 'Hello, ' }, { tag: 'strong', attrs: {}, children: [{ text: 'world!' }] }] }];
const html = htmlParseStringify.stringify(ast);

Other packages similar to html-parse-stringify

Keywords

FAQs

Package last updated on 28 Apr 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc