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

html-text-weaver

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-text-weaver

Encode html to its component plain-text and meta style parts

  • 1.0.9
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

html-text-weaver

Encode html to its component plain-text and meta style parts

{ encode, decode } = require('html-text-projection');

const html = '<h1>Hey, you! <b><i>Get out of there!</i></b></h1>';

encode(html);

// {
//  text: 'Hey, you! Get out of there!',
//  meta: [ [ 'h1', 0, 27 ], [ 'b', 10, 27 ], [ 'i', 10, 27 ] ] }
// }

decode(encode(html))

// '<h1>Hey, you! <b><i>Get out of there!</i></b></h1>'

Functions

{ text, meta } = encode(html)

Encode html into its component plain-text and meta style parts. Meta is an array of arrays of tag names, start, and end offests.

html = decode({ text, meta })

Decode text and meta parts back into html.

FAQs

Package last updated on 18 Oct 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