Skip to content

Commit 70051f8

Browse files
small edit in read me file.
1 parent 2dc9623 commit 70051f8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# lean-he
22

3-
_lean-he_ (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports [all standardized named character references as per HTML](https://html.spec.whatwg.org/multipage/syntax.html#named-character-references), handles [ambiguous ampersands](https://mathiasbynens.be/notes/ambiguous-ampersands) and other edge cases [just like a browser would](https://html.spec.whatwg.org/multipage/syntax.html#tokenizing-character-references), has an extensive test suite, and — contrary to many other JavaScript solutions — _lean-he_ handles astral Unicode symbols just fine. [An online demo is available.](https://mothereff.in/html-entities)
4-
It is forked from [he](https://github.com/mathiasbynens/he).
3+
_lean-he_ (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports [all standardized named character references as per HTML](https://html.spec.whatwg.org/multipage/syntax.html#named-character-references), handles [ambiguous ampersands](https://mathiasbynens.be/notes/ambiguous-ampersands) and other edge cases [just like a browser would](https://html.spec.whatwg.org/multipage/syntax.html#tokenizing-character-references), has an extensive test suite, and — contrary to many other JavaScript solutions — _lean-he_ handles astral Unicode symbols just fine.
4+
You can get a hint of how it works from [an online demo is available.](https://mothereff.in/html-entities) created by the same creator of original [he](https://github.com/mathiasbynens/he) library.
5+
This was created keeping bundling in mind. It will help in creating leaner bundle by using only the specific function developers needs, like if a use case requires only encoding then using `lean-he/encode`
6+
will result in only encode file to be bundle leaving rest of the code hence creating leaner bundle.
7+
8+
**It is forked from [he](https://github.com/mathiasbynens/he) with minute changes to make it leaner and all thanks to it's author.**
59

610
## Installation
711

@@ -37,7 +41,7 @@ load('lean-he.js');
3741

3842
This function takes a string of text and encodes (by default) any symbols that aren’t printable ASCII symbols and `&`, `<`, `>`, `"`, `'`, and `` ` ``, replacing them with character references.
3943

40-
>Can also use `var encode = require('encode');` instead to reduce the imported file size if the only need is to encode.
44+
>Can also use `var encode = require('lean-he/encode');` instead to reduce the imported file size if the only need is to encode.
4145
4246
```js
4347
lean_he.encode('foo © bar ≠ baz 𝌆 qux');
@@ -185,7 +189,7 @@ lean_he.encode('foo © bar ≠ baz 𝌆 qux');
185189

186190
This function takes a string of HTML and decodes any named and numerical character references in it using [the algorithm described in section 12.2.4.69 of the HTML spec](https://html.spec.whatwg.org/multipage/syntax.html#tokenizing-character-references).
187191

188-
>Can also use `var decode = require('decode');` instead to reduce the imported file size if the only need is to encode.
192+
>Can also use `var decode = require('lean-he/decode');` instead to reduce the imported file size if the only need is to decode.
189193
190194
```js
191195
lean_he.decode('foo &copy; bar &ne; baz &#x1D306; qux');
@@ -259,7 +263,7 @@ lean_he.decode('foo&ampbar');
259263

260264
This function takes a string of text and escapes it for use in text contexts in XML or HTML documents. Only the following characters are escaped: `&`, `<`, `>`, `"`, `'`, and `` ` ``.
261265

262-
>Can also use `var escape = require('escape');` instead to reduce the imported file size if the only need is to encode.
266+
>Can also use `var escape = require('lean-he/escape');` instead to reduce the imported file size if the only need is to escape.
263267
264268
```js
265269
lean_he.escape('<img src=\'x\' onerror="prompt(1)">');
@@ -270,7 +274,7 @@ lean_he.escape('<img src=\'x\' onerror="prompt(1)">');
270274

271275
`lean_he.unescape` is an alias for `lean_he.decode`. It takes a string of HTML and decodes any named and numerical character references in it.
272276

273-
>Can also use `var unescape = require('unescape');` instead to reduce the imported file size if the only need is to encode.
277+
>Can also use `var unescape = require('lean-he/unescape');` instead to reduce the imported file size if the only need is to unescape.
274278
275279
## Unit tests & code coverage
276280

0 commit comments

Comments
 (0)