Skip to content

escapeHtml

Import from @varavel/vdl-plugin-sdk/utils/strings.

function escapeHtml(str): string;

Converts special characters into safe HTML entities. Prevents basic XSS when rendering user-provided text in the DOM.

Parameters

Parameter Type Description
str string The string to escape.

Returns

string

The escaped string safe for HTML rendering.