Socket
Socket
Sign inDemoInstall

html-text-weaver

Package Overview
Dependencies
22
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

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


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
1.16 MB
Created
Weekly downloads
 

Readme

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

Last updated on 18 Oct 2021

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