/** * @bytevet/htmlsanitizer — A fast, allowlist-based HTML sanitizer powered by WebAssembly. * * @example * ```ts * import { sanitize, HtmlSanitizer } from "@bytevet/htmlsanitizer"; * * // Quick sanitization with defaults * const clean = sanitize('
Hello
'); * // => "Hello
" * * // Custom configuration * const s = new HtmlSanitizer(); * s.removeTag("a"); * const result = s.sanitize('link'); * // => "link" * ``` */ /** * Sanitize an HTML string using the default allow list. * * @param input - Raw HTML string to sanitize. * @returns Sanitized HTML string with dangerous elements/attributes removed. * * @example * ```ts * sanitize('text
'); * // => 'text
' * ``` */ export declare class HtmlSanitizer { private inner; constructor(); /** * Sanitize an HTML string using this sanitizer's configuration. */ sanitize(input: string): string; /** * Remove a tag from the allow list. * * @param name - Lowercase tag name to remove (e.g. "script", "a", "img"). */ removeTag(name: string): void; /** * Add a tag to the allow list. * * @param name - Lowercase tag name (e.g. "custom-element"). * @param attrs - Comma-separated non-URL attribute names, or empty string. * @param urlAttrs - Comma-separated URL attribute names, or empty string. */ addTag(name: string, attrs?: string, urlAttrs?: string): void; /** * Add a global attribute allowed on all tags. * * @param name - Attribute name (e.g. "data-testid"). */ addGlobalAttr(name: string): void; /** * Free the underlying WASM memory. The instance cannot be used after this. */ free(): void; } //# sourceMappingURL=index.d.ts.map