1.0.1 • Published 7 years ago

html-escape-translate v1.0.1

Weekly downloads
8
License
-
Repository
github
Last release
7 years ago

html-escape-translate

将html的'<','>',''', '"', '&' 标签分别转义成 '<', '>, '', '", '&' 或者反向将html的以上5个转义字符翻译成html的以上对应标签。

Example

import { escape, translate } from 'html-escape-translate';

let html = '<a href="http://xxx.com?p=1&q=2"></a>';
let text = "&lt;a href=&quot;http://xxx.com?p=1&amp;q=2&quot;&gt;&lt;/a&gt;";

console.log(escape(html));
console.log(translate(text));

Installation

npm install html-escape-translate