# html-escape-tools

> 提供了转义和还原HTML中特殊字符的功能

Latest version **1.0.1** (published 2022-10-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install html-escape-tools
pnpm add html-escape-tools
yarn add html-escape-tools
bun add html-escape-tools
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-10-21 |
| First published | 2022-10-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | xd_pig |
| Keywords | html-escape, html, escape |

## Links

- npm: https://www.npmjs.com/package/html-escape-tools
- npm.io page: https://npm.io/package/html-escape-tools

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-10-21
- 1.0.0 — 2022-10-21

## README

## 安装
```
npm i html-escape-tools
```


## 导入
```js
const escapeTools = require('html-escape-tools');
```


## 转义 HTML 中的特殊字符
```js
// 待转换的 HTML 字符串
const str = '<h1 title="123">123&nbsp;</h1>';
// 调用 htmlEscape 方法进行转换
const newStr = escapeTools.htmlEscape(str);
// 转换的结果 &lt;h1 title=&quot;123&quot;&gt;123&amp;nbsp;&lt;/h1&gt;
console.log(newStr)
```


## 还原 HTML 中的特殊字符
```js
// 待转换的 HTML 字符串
const str = '&lt;h1 title=&quot;123&quot;&gt;123&amp;nbsp;&lt;/h1&gt';
// 调用 htmlUnEscape 方法进行转换
const newStr = escapeTools.htmlUnEscape(str);
// 输出的结果 <h1 title="123">123&nbsp;</h1>
console.log(newStr);
```

## 开源协议
ISC

---
_Source: https://npm.io/package/html-escape-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
