Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

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

Properties

optional
useNamedReferences: boolean | undefined

The default value for the useNamedReferences option is false. This means that encode() will not use any named character references (e.g. ©) in the output — hexadecimal escapes (e.g. ©) will be used instead. Set it to true to enable the use of named references.

optional
decimal: boolean | undefined

The default value for the decimal option is false. If the option is enabled, encode will generally use decimal escapes (e.g. ©) rather than hexadecimal escapes (e.g. ©). Beside of this replacement, the basic behavior remains the same when combined with other options. For example: if both options useNamedReferences and decimal are enabled, named references (e.g. ©) are used over decimal escapes. HTML entities without a named reference are encoded using decimal escapes.

optional
encodeEverything: boolean | undefined

The default value for the encodeEverything option is false. This means that encode() will not use any character references for printable ASCII symbols that don’t need escaping. Set it to true to encode every symbol in the input string. When set to true, this option takes precedence over allowUnsafeSymbols (i.e. setting the latter to true in such a case has no effect).

optional
strict: boolean | undefined

The default value for the strict option is false. This means that encode() will encode any HTML text content you feed it, even if it contains any symbols that cause parse errors. To throw an error when such invalid HTML is encountered, set the strict option to true. This option makes it possible to use he as part of HTML parsers and HTML validators.

optional
allowUnsafeSymbols: boolean | undefined

The default value for the allowUnsafeSymbols option is false. This means that characters that are unsafe for use in HTML content (&, <, >, ", ', and `) will be encoded. When set to true, only non-ASCII characters will be encoded. If the encodeEverything option is set to true, this option will be ignored.