Socket
Socket
Sign inDemoInstall

html-decoder

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    html-decoder

The first HTML5 compliant HTML decoder based on HTML5 specification and can decode the full named character reference list based on this <a href="https://html


Version published
Maintainers
1
Install size
342 kB
Created

Readme

Source

HTML Decoder

The first HTML5 compliant HTML decoder. This decoder is implemented based on the HTML5 specification and can decode the full named character reference list based on this json.

Quick Start

Install the npm html-decoder from the npm repo.

npm install html-decoder

Server-side Use (node.js)

Decoding a string with numeric and named character reference.

/* create the html decoder */
var HTMLDecoder = require("html-decoder");
decoder = new HTMLDecoder();

var htmlString = "&gt;&gt&gta ...";
/* html = '<<<a...'; */
var html = decoder.decode(htmlString);

Development

Build

grunt

How to test

grunt test

Maintenance

Generate from WHATWG

grunt gen

OR doing it manually

Get the latest named character reference json.

wget https://html.spec.whatwg.org/multipage/entities.json

Generate the trie.

# $REPO_HOME is the home directory of this repo.
cp entities.json $REPO_HOME/data 

# the output is saved @ src/gen/trie.js
./bin/genhtmlentities data/entities.json

Test the build again.

grunt test

Future works

License

This software is free to use under the BSD license. See the LICENSE file for license text and copyright information.

Keywords

FAQs

Last updated on 25 Jun 2015

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