Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/frugal/docs/dep/he.ts>Encode

A frugal web framework
Go to Latest
interface Encode
import { type Encode } from "https://deno.land/x/frugal@0.5.0/docs/dep/he.ts";

Call Signatures

(text: string, options?: EncodeOptions): string

Encode a string of text

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.

As long as the input string contains allowed code points only, the return value of this function is always valid HTML. Any (invalid) code points that cannot be represented using a character reference in the input are not encoded.