8000 GitHub - neraliu/html-decoder: The first HTML5 compliant HTML decoder.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

neraliu/html-decoder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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");

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

Development

How to build

npm run-script build

How to test

npm test

Maintenance

Get the latest named character reference json from whatwg.org

npm run-script gen

OR doing it manually

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

npm test

License

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

About

The first HTML5 compliant HTML decoder.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0