sanitize-html/ 000755 001751 001751 0000000000 15152560246 015342 5 ustar 00runner 000000 000000 15152560246 15152560246 sanitize-html/LICENSE 000644 001751 001751 0000002165 15152560246 016353 0 ustar 00runner 000000 000000 15152560246 15152560246 MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
sanitize-html/README.md 000644 001751 001751 0000002015 15152560246 016617 0 ustar 00runner 000000 000000 15152560246 15152560246 # Installation
> `npm install --save @types/sanitize-html`
# Summary
This package contains type definitions for sanitize-html (https://github.com/punkave/sanitize-html).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sanitize-html.
### Additional Details
* Last updated: Fri, 06 Mar 2026 14:11:50 GMT
* Dependencies: [htmlparser2](https://npmjs.com/package/htmlparser2)
# Credits
These definitions were written by [Rogier Schouten](https://github.com/rogierschouten), [Afshin Darian](https://github.com/afshin), [Rinze de Laat](https://github.com/biermeester), [Johan Davidsson](https://github.com/johandavidson), [Jianrong Yu](https://github.com/YuJianrong), [GP](https://github.com/paambaati), [Dariusz Syncerek](https://github.com/dsyncerek), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Pirasis Leelatanon](https://github.com/1pete), [Alex Rantos](https://github.com/alex-rantos), and [Dylan Armstrong](https://github.com/dylanarmstrong).
sanitize-html/index.d.ts 000644 001751 001751 0000007223 15152560246 017247 0 ustar 00runner 000000 000000 15152560246 15152560246 import { ParserOptions } from "htmlparser2";
export = sanitize;
declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
declare namespace sanitize {
interface Attributes {
[attr: string]: string;
}
interface Tag {
tagName: string;
attribs: Attributes;
text?: string | undefined;
}
type Transformer = (tagName: string, attribs: Attributes) => Tag;
type AllowedAttribute = string | { name: string; multiple?: boolean | undefined; values: string[] };
type DisallowedTagsModes = "discard" | "escape" | "recursiveEscape" | "completelyDiscard";
// eslint-disable-next-line @typescript-eslint/naming-convention
interface IDefaults {
allowedAttributes: Record;
allowedSchemes: string[];
allowedSchemesByTag: { [index: string]: string[] };
allowedSchemesAppliedToAttributes: string[];
allowedTags: string[];
allowProtocolRelative: boolean;
disallowedTagsMode: DisallowedTagsModes;
enforceHtmlBoundary: boolean;
selfClosing: string[];
nonBooleanAttributes: string[];
}
// eslint-disable-next-line @typescript-eslint/naming-convention
interface IFrame {
tag: string;
attribs: { [index: string]: string };
text: string;
tagPosition: number;
mediaChildren: string[];
}
// eslint-disable-next-line @typescript-eslint/naming-convention
interface IOptions {
allowedAttributes?: Record | false | undefined;
allowedStyles?: { [index: string]: { [index: string]: RegExp[] } } | undefined;
allowedClasses?: { [index: string]: boolean | Array } | undefined;
allowedIframeDomains?: string[] | undefined;
allowedIframeHostnames?: string[] | undefined;
allowIframeRelativeUrls?: boolean | undefined;
allowedSchemes?: string[] | boolean | undefined;
allowedSchemesByTag?: { [index: string]: string[] } | boolean | undefined;
allowedSchemesAppliedToAttributes?: string[] | undefined;
allowedScriptDomains?: string[] | undefined;
allowedScriptHostnames?: string[] | undefined;
allowProtocolRelative?: boolean | undefined;
allowedTags?: string[] | false | undefined;
allowVulnerableTags?: boolean | undefined;
textFilter?: ((text: string, tagName: string) => string) | undefined;
exclusiveFilter?: ((frame: IFrame) => boolean | "excludeTag") | undefined;
nestingLimit?: number | undefined;
nonTextTags?: string[] | undefined;
/** @default true */
parseStyleAttributes?: boolean | undefined;
selfClosing?: string[] | undefined;
transformTags?: { [tagName: string]: string | Transformer } | undefined;
parser?: ParserOptions | undefined;
disallowedTagsMode?: DisallowedTagsModes | undefined;
/**
* Setting this option to true will instruct sanitize-html to discard all characters outside of html tag boundaries
* -- before `` and after `` tags
* @see {@link https://github.com/apostrophecms/sanitize-html/#discarding-text-outside-of-htmlhtml-tags}
* @default true
*/
enforceHtmlBoundary?: boolean | undefined;
nonBooleanAttributes?: string[];
onOpenTag?: ((name: string, attribs: Attributes) => void) | undefined;
onCloseTag?: ((name: string, isImplied: boolean) => void) | undefined;
}
const defaults: IDefaults;
const options: IOptions;
function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer;
}
sanitize-html/package.json 000644 001751 001751 0000004577 15152560246 017645 0 ustar 00runner 000000 000000 15152560246 15152560246 {
"name": "@types/sanitize-html",
"version": "2.16.1",
"description": "TypeScript definitions for sanitize-html",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sanitize-html",
"license": "MIT",
"contributors": [
{
"name": "Rogier Schouten",
"githubUsername": "rogierschouten",
"url": "https://github.com/rogierschouten"
},
{
"name": "Afshin Darian",
"githubUsername": "afshin",
"url": "https://github.com/afshin"
},
{
"name": "Rinze de Laat",
"githubUsername": "biermeester",
"url": "https://github.com/biermeester"
},
{
"name": "Johan Davidsson",
"githubUsername": "johandavidson",
"url": "https://github.com/johandavidson"
},
{
"name": "Jianrong Yu",
"githubUsername": "YuJianrong",
"url": "https://github.com/YuJianrong"
},
{
"name": "GP",
"githubUsername": "paambaati",
"url": "https://github.com/paambaati"
},
{
"name": "Dariusz Syncerek",
"githubUsername": "dsyncerek",
"url": "https://github.com/dsyncerek"
},
{
"name": "Piotr Błażejewicz",
"githubUsername": "peterblazejewicz",
"url": "https://github.com/peterblazejewicz"
},
{
"name": "Pirasis Leelatanon",
"githubUsername": "1pete",
"url": "https://github.com/1pete"
},
{
"name": "Alex Rantos",
"githubUsername": "alex-rantos",
"url": "https://github.com/alex-rantos"
},
{
"name": "Dylan Armstrong",
"githubUsername": "dylanarmstrong",
"url": "https://github.com/dylanarmstrong"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/sanitize-html"
},
"scripts": {},
"dependencies": {
"htmlparser2": "^10.1"
},
"peerDependencies": {},
"typesPublisherContentHash": "b9595364756c7aa91f17d55c6e4110ba2948b907d98ff58edbd7d6340b84b7a5",
"typeScriptVersion": "5.2"
}