DefinitelyTyped/types/sanitize-html/index.d.ts
BehindTheMath f7fb43c092 sanitize-html: add allowedSchemesByTag, allowProtocolRelative to IOptions (#20407)
* sanitize-html: add allowedSchemesByTag to IOptions

* sanitize-html: add allowProtocolRelative to IOptions
2017-10-09 14:39:53 -07:00

58 lines
1.6 KiB
TypeScript

// Type definitions for sanitize-html 1.14.1
// Project: https://github.com/punkave/sanitize-html
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Afshin Darian <https://github.com/afshin>
// BehindTheMath <https://github.com/BehindTheMath>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = sanitize;
declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
declare namespace sanitize {
type Attributes = { [attr: string]: string };
type Tag = { tagName: string; attribs: Attributes; text?: string; };
type Transformer = (tagName: string, attribs: Attributes) => Tag;
interface IDefaults {
allowedAttributes: { [index: string]: string[] };
allowedSchemes: string[];
allowedSchemesByTag: { [index: string]: string[] };
allowedTags: string[];
selfClosing: string[];
}
interface IFrame {
tag: string;
attribs: { [index: string]: string };
text: string;
tagPosition: number;
}
interface IOptions {
allowedAttributes?: { [index: string]: string[] } | boolean;
allowedClasses?: { [index: string]: string[] } | boolean;
allowedSchemes?: string[] | boolean;
allowedSchemesByTag?: { [index: string]: string[] } | boolean;
allowProtocolRelative?: boolean;
allowedTags?: string[] | boolean;
exclusiveFilter?: (frame: IFrame) => boolean;
nonTextTags?: string[];
selfClosing?: string[];
transformTags?: { [tagName: string]: string | Transformer };
}
var defaults: IDefaults;
function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer;
}