Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
html-escaper
Advanced tools
Package description
The html-escaper npm package is designed to escape and unescape HTML entities. It is useful for preventing XSS attacks by sanitizing user input or for properly displaying text that includes characters that are reserved in HTML.
Escape HTML
Escapes HTML entities to prevent execution of potentially harmful scripts and to display HTML tags as plain text.
const { escape } = require('html-escaper');
const escapedString = escape('<div>Hello & Welcome!</div>');
console.log(escapedString); // <div>Hello & Welcome!</div>
Unescape HTML
Unescapes HTML entities to convert them back to their original characters, which is useful for rendering text that was previously escaped.
const { unescape } = require('html-escaper');
const unescapedString = unescape('<div>Hello & Welcome!</div>');
console.log(unescapedString); // <div>Hello & Welcome!</div>
The 'he' package is a robust HTML entity encoder/decoder written in JavaScript. It supports all named character references defined in HTML, handling even obscure and rare entities. It is more comprehensive than html-escaper but might be larger in size.
The 'escape-html' package is a simple and fast utility for escaping HTML entities. It is smaller and more lightweight than html-escaper, but it only provides the escaping functionality and does not include unescaping.
The 'entities' package is another library for encoding and decoding HTML entities. It supports a wide range of character entities and offers both escaping and unescaping functionalities, similar to html-escaper, but with additional options for handling different document types.
Readme
A module to escape/unescape common problematic entities done the right way.
FAQs
fast and safe way to escape and unescape &<>'" chars
The npm package html-escaper receives a total of 15,199,326 weekly downloads. As such, html-escaper popularity was classified as popular.
We found that html-escaper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.