Files
herolib/aiprompts/v_core/encoding/html.md
2025-09-02 07:28:13 +02:00

1.2 KiB

module html

Contents

escape

fn escape(input string, config EscapeConfig) string

escape converts special characters in the input, specifically "<", ">", and "&" to HTML-safe sequences. If quote is set to true (which is default), quotes in HTML will also be translated. Both double and single quotes will be affected. Note: escape() supports funky accents by doing nothing about them. V's UTF-8 support through string is robust enough to deal with these cases.

[Return to contents]

unescape

fn unescape(input string, config UnescapeConfig) string

unescape converts entities like "<" to "<". By default it is the converse of escape. If all is set to true, it handles named, numeric, and hex values - for example, '&apos;', '&#39;', and '&#x27;' then unescape to "'".

[Return to contents]

EscapeConfig

struct EscapeConfig {
pub:
	quote bool = true
}

[Return to contents]

UnescapeConfig

struct UnescapeConfig {
	EscapeConfig
pub:
	all bool
}

[Return to contents]

Powered by vdoc. Generated on: 2 Sep 2025 07:18:04