• Version 2.9.5
  • Published
  • 7.82 kB
  • 1 dependency
  • MIT license


npm i @types/sanitize-html
yarn add @types/sanitize-html
pnpm add @types/sanitize-html


TypeScript definitions for sanitize-html



variable defaults

const defaults: IDefaults;

    variable options

    const options: IOptions;


      function sanitize

      sanitize: typeof sanitize;

        function simpleTransform

        simpleTransform: (
        tagName: string,
        attribs: Attributes,
        merge?: boolean
        ) => Transformer;


          interface Attributes

          interface Attributes {}

            index signature

            [attr: string]: string;

              interface IDefaults

              interface IDefaults {}

                property allowedAttributes

                allowedAttributes: Record<string, AllowedAttribute[]>;

                  property allowedSchemes

                  allowedSchemes: string[];

                    property allowedSchemesAppliedToAttributes

                    allowedSchemesAppliedToAttributes: string[];

                      property allowedSchemesByTag

                      allowedSchemesByTag: { [index: string]: string[] };

                        property allowedTags

                        allowedTags: string[];

                          property allowProtocolRelative

                          allowProtocolRelative: boolean;

                            property disallowedTagsMode

                            disallowedTagsMode: DisallowedTagsModes;

                              property enforceHtmlBoundary

                              enforceHtmlBoundary: boolean;

                                property selfClosing

                                selfClosing: string[];

                                  interface IFrame

                                  interface IFrame {}

                                    property attribs

                                    attribs: { [index: string]: string };

                                      property mediaChildren

                                      mediaChildren: string[];

                                        property tag

                                        tag: string;

                                          property tagPosition

                                          tagPosition: number;

                                            property text

                                            text: string;

                                              interface IOptions

                                              interface IOptions {}

                                                property allowedAttributes

                                                allowedAttributes?: Record<string, AllowedAttribute[]> | false | undefined;

                                                  property allowedClasses

                                                  | { [index: string]: boolean | Array<string | RegExp> }
                                                  | undefined;

                                                    property allowedIframeDomains

                                                    allowedIframeDomains?: string[] | undefined;

                                                      property allowedIframeHostnames

                                                      allowedIframeHostnames?: string[] | undefined;

                                                        property allowedSchemes

                                                        allowedSchemes?: string[] | boolean | undefined;

                                                          property allowedSchemesAppliedToAttributes

                                                          allowedSchemesAppliedToAttributes?: string[] | undefined;

                                                            property allowedSchemesByTag

                                                            allowedSchemesByTag?: { [index: string]: string[] } | boolean | undefined;

                                                              property allowedScriptDomains

                                                              allowedScriptDomains?: string[] | undefined;

                                                                property allowedScriptHostnames

                                                                allowedScriptHostnames?: string[] | undefined;

                                                                  property allowedStyles

                                                                  allowedStyles?: { [index: string]: { [index: string]: RegExp[] } } | undefined;

                                                                    property allowedTags

                                                                    allowedTags?: string[] | false | undefined;

                                                                      property allowIframeRelativeUrls

                                                                      allowIframeRelativeUrls?: boolean | undefined;

                                                                        property allowProtocolRelative

                                                                        allowProtocolRelative?: boolean | undefined;

                                                                          property allowVulnerableTags

                                                                          allowVulnerableTags?: boolean | undefined;

                                                                            property disallowedTagsMode

                                                                            disallowedTagsMode?: DisallowedTagsModes | undefined;

                                                                              property enforceHtmlBoundary

                                                                              enforceHtmlBoundary?: boolean | undefined;

                                                                              property exclusiveFilter

                                                                              exclusiveFilter?: ((frame: IFrame) => boolean) | undefined;

                                                                                property nestingLimit

                                                                                nestingLimit?: number | undefined;

                                                                                  property nonTextTags

                                                                                  nonTextTags?: string[] | undefined;

                                                                                    property parser

                                                                                    parser?: ParserOptions | undefined;

                                                                                      property parseStyleAttributes

                                                                                      parseStyleAttributes?: boolean | undefined;
                                                                                      • true

                                                                                      property selfClosing

                                                                                      selfClosing?: string[] | undefined;

                                                                                        property textFilter

                                                                                        textFilter?: ((text: string, tagName: string) => string) | undefined;

                                                                                          property transformTags

                                                                                          transformTags?: { [tagName: string]: string | Transformer } | undefined;

                                                                                            interface Tag

                                                                                            interface Tag {}

                                                                                              property attribs

                                                                                              attribs: Attributes;

                                                                                                property tagName

                                                                                                tagName: string;

                                                                                                  property text

                                                                                                  text?: string | undefined;

                                                                                                    Type Aliases

                                                                                                    type AllowedAttribute

                                                                                                    type AllowedAttribute =
                                                                                                    | string
                                                                                                    | { name: string; multiple?: boolean | undefined; values: string[] };

                                                                                                      type DisallowedTagsModes

                                                                                                      type DisallowedTagsModes = 'discard' | 'escape' | 'recursiveEscape';

                                                                                                        type Transformer

                                                                                                        type Transformer = (tagName: string, attribs: Attributes) => Tag;

                                                                                                          Package Files (1)

                                                                                                          Dependencies (1)

                                                                                                          Dev Dependencies (0)

                                                                                                          No dev dependencies.

                                                                                                          Peer Dependencies (0)

                                                                                                          No peer dependencies.


                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/sanitize-html.

                                                                                                          • Markdown
                                                                                                          • HTML
                                                                                                            <a href="https://www.jsdocs.io/package/@types/sanitize-html"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>