# xmlunidefuse

> Encode the predefined XML entities (amp, lt, gt, apos, quot) and some additional, easily overlooked Unicode characters. Opt-out CharRef 39 for HTML.

Latest version **0.1.4** (published 2016-09-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install xmlunidefuse
pnpm add xmlunidefuse
yarn add xmlunidefuse
bun add xmlunidefuse
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2016-09-10 |
| First published | 2016-08-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | M.K. |
| Maintainers | mk-pmb |
| Keywords | apos, CDATA, cdata, CLI, cli, defuse, encode, xmlencode, xmlentities, htmlspecialchars, entity, entities, HTML, html, unicode, univeil, XML, xml |

## Links

- npm: https://www.npmjs.com/package/xmlunidefuse
- Repository: https://github.com/mk-pmb/xmlunidefuse-js
- Homepage: https://github.com/mk-pmb/xmlunidefuse-js#readme
- Issues: https://github.com/mk-pmb/xmlunidefuse-js/issues
- npm.io page: https://npm.io/package/xmlunidefuse

## Dependencies (2)

- [univeil](https://npm.io/package/univeil.md) ^0.1.7
- [xmldefuse](https://npm.io/package/xmldefuse.md) ^0.1.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2016-09-10
- 0.1.2 — 2016-08-29
- 0.1.1 — 2016-08-29
- 0.1.0 — 2016-08-29

## README

xmlunidefuse
============
Encode the [predefined XML entities][xml-predent] (amp, lt, gt, apos, quot)
and some additional, easily overlooked Unicode characters.
Opt-out [CharRef][xml-charref] 39 for HTML ([Why?][why-opt-out]).

Usage
-----
From [test.js](test.js):
```javascript
var xud = require("xmlunidefuse"), eq = require("assert").strictEqual,
  raw = "<​!-- <u snow=\"man'>☃</u -->";

eq(xud(raw),        //  HTML compat mode:    v..
  "&lt;&#x200B;!-- &lt;u&#xA0;snow=&quot;man&#39;&gt;☃&lt;/u&#x205F;--&gt;");

eq(xud.apos(raw),   //  apos opt-in:         v...
  "&lt;&#x200B;!-- &lt;u&#xA0;snow=&quot;man&apos;&gt;☃&lt;/u&#x205F;--&gt;");

//  CDATA mode is implemented but not recommended,
//  because it makes the sneaky chars VERY visible.
eq(xud.cdata(raw),
  '<![CDATA[<]]>&#x200B;<![CDATA[!-- <u]]>&#xA0;<![CDATA[snow="ma' +
  "n'>☃</u]]>&#x205F;<![CDATA[-->]]>");
```




Related
-------
  * [univeil](https://www.npmjs.com/package/univeil):
    Unveil sneaky Unicode characters.
  * [xmldefuse](https://www.npmjs.com/package/xmldefuse):
    Encode only the predefined XML entities.
  * [xmldecode](https://www.npmjs.com/package/xmldecode):
    Decode the predefined XML entities, CharRefs and CDATA sections.


  [why-opt-out]: https://www.npmjs.com/package/xmldefuse#why-is-apos-opt-in
  [xml-charref]: https://www.w3.org/TR/REC-xml/#NT-CharRef
  [xml-predent]: https://www.w3.org/TR/REC-xml/#sec-predefined-ent


License
-------
ISC

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