Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. JavaScript
  3. he

he

MITJavaScript

A robust JavaScript library for encoding and decoding HTML entities with full spec compliance.

Visit WebsiteGitHubGitHub
3.6k stars264 forks0 contributors

What is he?

he is a JavaScript library for encoding and decoding HTML entities. It converts special characters to their corresponding HTML entity references (like & or &) and vice versa, ensuring text is safely embedded in HTML documents. It solves the problem of inconsistent or incomplete entity handling in other libraries by strictly following the HTML specification.

Target Audience

Web developers and library authors who need reliable HTML entity processing in JavaScript applications, especially those building HTML parsers, validators, or text sanitization tools.

Value Proposition

Developers choose he for its exact compliance with the HTML specification, robust handling of edge cases (including astral Unicode symbols), and extensive configurability. It's the most reliable option when browser-like entity processing is required.

Overview

A robust HTML entity encoder/decoder written in JavaScript.

Use Cases

Best For

  • Encoding user-generated content for safe HTML embedding
  • Decoding HTML entities in scraped or external HTML content
  • Building HTML parsers or validators that need spec-compliant entity handling
  • Processing text with astral Unicode symbols (e.g., emojis, mathematical symbols)
  • Command-line batch processing of HTML entity encoding/decoding
  • Ensuring consistent entity handling across different JavaScript environments

Not Ideal For

  • Projects requiring only minimal text escaping for XSS prevention without full HTML spec compliance
  • Applications with strict bundle size limits where a lighter entity library is necessary
  • Real-time text processing in performance-critical scenarios like gaming or live data feeds
  • Use cases involving non-HTML entity standards such as XML or custom markup languages

Pros & Cons

Pros

Full HTML Spec Compliance

Implements all standardized named character references and handles edge cases like ambiguous ampersands exactly as browsers do, ensuring reliable behavior per the HTML specification.

Astral Unicode Support

Correctly encodes and decodes astral symbols such as emojis and mathematical characters, a feature many other JavaScript libraries fail to provide.

Flexible Configuration

Offers multiple encoding options including named references, decimal escapes, strict mode for validation, and context-aware decoding for different HTML contexts.

Comprehensive Test Suite

Extensively tested across various browsers and environments, ensuring high reliability and compatibility for diverse use cases.

Command-Line Interface

Includes a binary for shell usage, enabling easy batch processing of HTML entities from the command line, which is useful for scripting and automation.

Cons

No Integrated Sanitization

Only handles entity encoding/decoding; does not provide HTML sanitization, requiring additional libraries for full security against XSS attacks.

Performance Overhead

Full spec compliance and extensive feature set may introduce slower performance compared to minimalist escaping functions for basic tasks.

Configuration Complexity

Numerous options like useNamedReferences and encodeEverything can be overwhelming for developers with simple needs, increasing learning curve.

Frequently Asked Questions

Quick Stats

Stars3,613
Forks264
Contributors0
Open Issues20
Last commit4 years ago
CreatedSince 2013

Tags

#encoder#unicode#cli-tool#text-processing#spec-compliance#nodejs#javascript-library#javascript#browser#decoder

Built With

J
JavaScript

Links & Resources

Website

Included in

Node.js65.5kJavaScript34.9k
Auto-fetched 1 day ago

Related Projects

nanoidnanoid

A tiny (118 bytes), secure, URL-friendly, unique string ID generator for JavaScript

Stars26,749
Forks842
Last commit9 days ago
i18nexti18next

i18next: learn once - translate everywhere

Stars8,548
Forks686
Last commit6 days ago
query-stringquery-string

Parse and stringify URL query strings

Stars6,906
Forks451
Last commit7 months ago
URI.jsURI.js

Javascript URL mutation library

Stars6,234
Forks474
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub