character-reference-invalid
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,30 +0,6 @@ | ||
export var characterReferenceInvalid: { | ||
0: string | ||
128: string | ||
130: string | ||
131: string | ||
132: string | ||
133: string | ||
134: string | ||
135: string | ||
136: string | ||
137: string | ||
138: string | ||
139: string | ||
140: string | ||
142: string | ||
145: string | ||
146: string | ||
147: string | ||
148: string | ||
149: string | ||
150: string | ||
151: string | ||
152: string | ||
153: string | ||
154: string | ||
155: string | ||
156: string | ||
158: string | ||
159: string | ||
} | ||
/** | ||
* Map of invalid numeric character references to their replacements, according to HTML. | ||
* | ||
* @type {Record<number, string>} | ||
*/ | ||
export const characterReferenceInvalid: Record<number, string> |
@@ -1,2 +0,7 @@ | ||
export var characterReferenceInvalid = { | ||
/** | ||
* Map of invalid numeric character references to their replacements, according to HTML. | ||
* | ||
* @type {Record<number, string>} | ||
*/ | ||
export const characterReferenceInvalid = { | ||
0: '�', | ||
@@ -3,0 +8,0 @@ 128: '€', |
{ | ||
"name": "character-reference-invalid", | ||
"version": "2.0.0", | ||
"description": "HTML invalid numeric character reference information", | ||
"version": "2.0.1", | ||
"description": "Map of invalid numeric character references to their replacements, according to HTML", | ||
"license": "MIT", | ||
@@ -36,16 +36,17 @@ "keywords": [ | ||
"@types/tape": "^4.0.0", | ||
"bail": "^1.0.0", | ||
"bail": "^2.0.0", | ||
"c8": "^7.0.0", | ||
"concat-stream": "^2.0.0", | ||
"hast-util-select": "^4.0.0", | ||
"hast-util-to-string": "^1.0.0", | ||
"hast-util-select": "^5.0.0", | ||
"hast-util-to-string": "^2.0.0", | ||
"prettier": "^2.0.0", | ||
"rehype-parse": "^7.0.0", | ||
"remark-cli": "^9.0.0", | ||
"remark-preset-wooorm": "^8.0.0", | ||
"rehype-parse": "^8.0.0", | ||
"remark-cli": "^10.0.0", | ||
"remark-preset-wooorm": "^9.0.0", | ||
"rimraf": "^3.0.0", | ||
"tape": "^5.0.0", | ||
"type-coverage": "^2.0.0", | ||
"typescript": "^4.0.0", | ||
"unified": "^9.0.0", | ||
"xo": "^0.38.0" | ||
"unified": "^10.0.0", | ||
"xo": "^0.45.0" | ||
}, | ||
@@ -55,7 +56,6 @@ "scripts": { | ||
"generate": "node build", | ||
"prebuild": "rimraf \"*.d.ts\"", | ||
"build": "tsc", | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage", | ||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", | ||
"test-api": "node test", | ||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js", | ||
"test-api": "node --conditions development test.js", | ||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api", | ||
"test": "npm run generate && npm run build && npm run format && npm run test-coverage" | ||
@@ -72,9 +72,3 @@ }, | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"import/no-mutable-exports": "off", | ||
"no-var": "off", | ||
"prefer-arrow-callback": "off", | ||
"unicorn/prefer-number-properties": "off" | ||
} | ||
"prettier": true | ||
}, | ||
@@ -85,3 +79,9 @@ "remarkConfig": { | ||
] | ||
}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
105
readme.md
@@ -8,11 +8,40 @@ # character-reference-invalid | ||
HTML invalid numeric character reference information. | ||
Map of invalid numeric character references to their replacements, according to | ||
HTML. | ||
## Contents | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`characterReferenceInvalid`](#characterreferenceinvalid) | ||
* [Source](#source) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Related](#related) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
## What is this? | ||
This is a map from the [HTML spec][source] of C1 ASCII/Unicode control | ||
characters (which are disallowed by HTML) to the characters those code points | ||
would have in Windows 1252. | ||
For example, U+0080 (Padding Character) maps to `€`, because that’s used for | ||
0x80 in Windows 1252. | ||
## When should I use this? | ||
Probably never, unless you’re dealing with parsing HTML or similar XML-like | ||
things, or in a place where Unicode is not the primary encoding (it is in most | ||
places). | ||
## Install | ||
This package is ESM only: Node 12+ is needed to use it and it must be `import`ed | ||
instead of `require`d. | ||
This package is [ESM only][esm]. | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
[npm][]: | ||
```sh | ||
@@ -22,2 +51,16 @@ npm install character-reference-invalid | ||
In Deno with [Skypack][]: | ||
```js | ||
import {characterReferenceInvalid} from 'https://cdn.skypack.dev/character-reference-invalid@2?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import {characterReferenceInvalid} from 'https://cdn.skypack.dev/character-reference-invalid@2?min' | ||
</script> | ||
``` | ||
## Use | ||
@@ -40,21 +83,41 @@ | ||
Mapping between invalid numeric character reference to replacements. | ||
`Record<number, string>` — mapping between invalid numeric character reference | ||
codes to replacements characters. | ||
## Support | ||
## Source | ||
See [`html.spec.whatwg.org`][html]. | ||
See [`html.spec.whatwg.org`][source]. | ||
## Types | ||
This package is fully typed with [TypeScript][]. | ||
## Compatibility | ||
This package is at least compatible with all maintained versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
It also works in Deno and modern browsers. | ||
## Security | ||
This package is safe. | ||
## Related | ||
* [`character-entities`](https://github.com/wooorm/character-entities) | ||
* [`wooorm/character-entities`](https://github.com/wooorm/character-entities) | ||
— HTML character entity info | ||
* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4) | ||
* [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4) | ||
— HTML 4 character entity info | ||
* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) | ||
— Legacy character entity info | ||
* [`parse-entities`](https://github.com/wooorm/parse-entities) | ||
— Parse HTML character references | ||
* [`stringify-entities`](https://github.com/wooorm/stringify-entities) | ||
— Serialize HTML character references | ||
* [`wooorm/character-entities-legacy`](https://github.com/wooorm/character-entities-legacy) | ||
— legacy character entity info | ||
* [`wooorm/parse-entities`](https://github.com/wooorm/parse-entities) | ||
— parse HTML character references | ||
* [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities) | ||
— serialize HTML character references | ||
## Contribute | ||
Yes please! | ||
See [How to Contribute to Open Source][contribute]. | ||
## License | ||
@@ -84,2 +147,4 @@ | ||
[skypack]: https://www.skypack.dev | ||
[license]: license | ||
@@ -89,2 +154,8 @@ | ||
[html]: https://html.spec.whatwg.org/multipage/parsing.html#table-charref-overrides | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[typescript]: https://www.typescriptlang.org | ||
[contribute]: https://opensource.guide/how-to-contribute/ | ||
[source]: https://html.spec.whatwg.org/multipage/parsing.html#table-charref-overrides |
8428
157
16
41