CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
readme.md153 linesDownload Raw Back to character-entities
1# character-entities2 3[![Build][build-badge]][build]4[![Coverage][coverage-badge]][coverage]5[![Downloads][downloads-badge]][downloads]6[![Size][size-badge]][size]7 8Map of named character references.9 10## Contents11 12*   [What is this?](#what-is-this)13*   [When should I use this?](#when-should-i-use-this)14*   [Install](#install)15*   [Use](#use)16*   [API](#api)17    *   [characterEntities](#characterentities)18*   [Types](#types)19*   [Compatibility](#compatibility)20*   [Security](#security)21*   [Related](#related)22*   [Contribute](#contribute)23*   [License](#license)24 25## What is this?26 27This is a map of named character references in HTML (latest) to the characters28they represent.29 30## When should I use this?31 32Maybe when you’re writing an HTML parser or minifier, but otherwise probably33never!34Even then, it might be better to use [`parse-entities`][parse-entities] or35[`stringify-entities`][stringify-entities].36 37## Install38 39This package is [ESM only][esm].40In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install with [npm][]:41 42```sh43npm install character-entities44```45 46In Deno with [`esm.sh`][esmsh]:47 48```js49import {characterEntities} from 'https://esm.sh/character-entities@2'50```51 52In browsers with [`esm.sh`][esmsh]:53 54```html55<script type="module">56  import {characterEntities} from 'https://esm.sh/character-entities@2?bundle'57</script>58```59 60## Use61 62```js63import {characterEntities} from 'character-entities'64 65console.log(characterEntities.AElig) // => 'Æ'66console.log(characterEntities.aelig) // => 'æ'67console.log(characterEntities.amp) // => '&'68```69 70## API71 72This package exports the identifier `characterEntities`.73There is no default export.74 75### characterEntities76 77Mapping between (case-sensitive) character entity names to replacements.78See [`html.spec.whatwg.org`][html] for more info.79 80## Types81 82This package is fully typed with [TypeScript][].83 84## Compatibility85 86This package is at least compatible with all maintained versions of Node.js.87As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+.88It also works in Deno and modern browsers.89 90## Security91 92This package is safe.93 94## Related95 96*   [`wooorm/parse-entities`](https://github.com/wooorm/parse-entities)97    — parse (decode) character references98*   [`wooorm/stringify-entities`](https://github.com/wooorm/stringify-entities)99    — serialize (encode) character references100*   [`wooorm/character-entities-html4`](https://github.com/wooorm/character-entities-html4)101    — info on named character references in HTML 4102*   [`character-reference-invalid`](https://github.com/wooorm/character-reference-invalid)103    — info on invalid numeric character references104*   [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy)105    — info on legacy named character references106 107## Contribute108 109Yes please!110See [How to Contribute to Open Source][contribute].111 112## License113 114[MIT][license] © [Titus Wormer][author]115 116<!-- Definitions -->117 118[build-badge]: https://github.com/wooorm/character-entities/workflows/main/badge.svg119 120[build]: https://github.com/wooorm/character-entities/actions121 122[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities.svg123 124[coverage]: https://codecov.io/github/wooorm/character-entities125 126[downloads-badge]: https://img.shields.io/npm/dm/character-entities.svg127 128[downloads]: https://www.npmjs.com/package/character-entities129 130[size-badge]: https://img.shields.io/bundlephobia/minzip/character-entities.svg131 132[size]: https://bundlephobia.com/result?p=character-entities133 134[npm]: https://docs.npmjs.com/cli/install135 136[esmsh]: https://esm.sh137 138[license]: license139 140[author]: https://wooorm.com141 142[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c143 144[typescript]: https://www.typescriptlang.org145 146[contribute]: https://opensource.guide/how-to-contribute/147 148[parse-entities]: https://github.com/wooorm/parse-entities149 150[stringify-entities]: https://github.com/wooorm/stringify-entities151 152[html]: https://html.spec.whatwg.org/multipage/syntax.html#named-character-references153