• Convert a string or HTMLString into a sanitized HTMLString. Plain text (anything isHTMLString does not recognize as markup) is HTML-escaped and wrapped in wrapperTag; markup is passed through Foundry's allowlist sanitizer (fvttCleanHTML), which drops every disallowed tag and attribute. This is the single HTML sanitizer for chat-card and dialog content, reached via toHTMLWithTemplate / toHTMLWithContent.

    Parameters

    • value: string | HTMLString

      Plain text or HTML markup to sanitize.

    • wrapperTag: "p" | "div" | "span" = "p"

      Element used to wrap plain-text input (default "p").

    Returns HTMLString

    The sanitized HTML markup.