Fb55 Entities Versions Save

encode & decode HTML & XML entities with ease & speed

v4.5.0

1 year ago

New Features

entities now features an EntityDecoder class that can be used to decode entities across multiple chunks. This is needed to parse streams, and will be the foundation for entity decoding in htmlparser2 and parse5.

For users of this library, the most welcome addition will be a new attribute decoding mode, which will ignore some entities that were previously parsed (eg. `foo=bar&amp=boo' will be left unchanged).

entities' decode functions all use the new decoder under the hood. There is a new decodeHTMLAttribute function for attribute parsing, and some rare edge-cases where entities diverged from the HTML spec have been eliminated.

Relevant PRs

Small Changes

Full Changelog: https://github.com/fb55/entities/compare/v4.4.0...v4.5.0

v4.4.0

1 year ago

Please note that some JavaScript minifiers, such as terser, will now produce non-ASCII output. If you use entities in the browser, please make sure you are set up to ship UTF-8 to clients, or set eg. terser's ascii_only option to false.

Full Changelog: https://github.com/fb55/entities/compare/v4.3.1...v4.4.0

v4.3.1

1 year ago
  • Fixed an off-by-one error that caused some entities to be decoded to different values (#858) 3b0d48b

https://github.com/fb55/entities/compare/v4.3.0...v4.3.1

v4.3.0

2 years ago

Features

Other

Full Changelog: https://github.com/fb55/entities/compare/v4.2.0...v4.3.0

v4.2.0

2 years ago

Fixes:

  • Handle edge-case with surrogate pairs in encode 413c48b

Features:

  • Export replaceCodePoint from entities/lib/decode 2247ebe

Other:

  • refactor: Enable strict-boolean-expressions (#779) ce2b30b
  • refactor(encode): Skip isHighSurrogate check 03a8f4a
  • chore(ci): Test on its/* instead of Node 10 1a69212
  • chore(scripts): Add tests for decoding of binary trie, fix logic 6cb56f3
  • chore(scripts): Add .eslintrc.json bf89c65

https://github.com/fb55/entities/compare/v4.1.1...v4.2.0

v4.1.1

2 years ago
  • fix: Missed ESM change by @Jiralite (#778) b4a04cb

https://github.com/fb55/entities/compare/v4.1.0...v4.1.1

v4.1.0

2 years ago
  • We now pre-generate the encode trie (#776) 3ef75e1
    • This increases the code size a bit, while reducing memory consumption and improving tooling support.
  • Improved the README 8a194ce b7b24d6

https://github.com/fb55/entities/compare/v4.0.0...v4.1.0

v4.0.0

2 years ago

New Features:

  • entities is now both an ESM and a CommonJS module (#775)
  • entities now has a new documentation website! (Added in 720a36d.)
  • Added escapeAttribute and escapeText functions, implementing the escaping required by the HTML serializer algorithm (#770)

Breaking:

  • The format of the decode tries has changed, leading to ~20% space savings when loaded. The format is described in detail at https://github.com/fb55/entities/blob/master/scripts/trie/README.md. Relevant PRs:
    • refactor(trie): Store short values in nodes (#773) 7347f3a
    • refactor(trie): Simplify trie, add documentation (#766) 6c17a1e
  • Moved the base maps out of the bundle (#772) 0af5d6d
    • We now use a smaller map for encoding entities, see #771

Docs:

  • docs(readme): Add FAQ about strict decoding c2e2c93
  • docs(readme): Add Features section, plus small improvements 3f66dd6
  • docs(readme): Add FAQ section 14f1732

Refactors:

  • refactor(encode): Inline replacers, xml code map (#765) c7b81ad
  • refactor: Share escaping logic between escape fns 2a2bc5f
  • refactor(decode): Defer creating string to the end of the trie 0fa1149

v3.0.1

2 years ago
  • Fixes an issue where some characters above the high surrogate plane would be considered as surrogate characters as well (#562) 769ce35

https://github.com/fb55/entities/compare/v3.0.0...v3.0.1

v3.0.0

2 years ago

[email protected] features more configurable encode and decode functions and rewritten decode & encode functions, resulting in a huge speedup.

New Features:

  • feat: Add new API for encode, decode functions 817ae67

You can now pass an object with additional configuration options to the exported encode and decode function. You can still use the relevant function directly, but this will make it easier to figure out what you want to do in the first place!

Refactors:

  • refactor(encode): Use trie for encoding (#559) f6f7cd9
  • refactor(decode): Use serialised binary trie for decoding (#556, #557) 267d32e c038c63

entities is now using tries for encoding and decoding entities. Especially when decoding, this leads to considerable performance improvements. The simple benchmark in scripts/benchmark.ts is useful for comparing the performance of these two versions:

Version decode perf encode perf escape perf
3.0.0 1.418s 6.786s 2.196s
2.2.0 4.085s 14.842s 5.166s
Speedup 2.9x 2.1x 2.4x

Heroes of this release:

  • @inikulin for his work on binary decoding tries for the parse5 project, which was the basis for the decode trie implemented in this project.
  • @mdevils for being a great opponent in entity library performance. entities was the fastest library in the space for a while. The friendly competition was a great reason to come up with smarter algorithms to push the envelope just a bit further. Now entities is on top again, but we'll see how long that lasts!