@types/sanitize-html 2.8.1 → 2.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sanitize-html/LICENSE +0 -0
- sanitize-html/README.md +1 -1
- sanitize-html/index.d.ts +69 -61
- sanitize-html/package.json +3 -3
sanitize-html/LICENSE
CHANGED
|
File without changes
|
sanitize-html/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for sanitize-html (https://github.com/pun
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sanitize-html.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Mon, 25 Sep 2023 13:39:06 GMT
|
|
12
12
|
* Dependencies: [@types/htmlparser2](https://npmjs.com/package/@types/htmlparser2)
|
|
13
13
|
* Global values: none
|
|
14
14
|
|
sanitize-html/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for sanitize-html 2.
|
|
1
|
+
// Type definitions for sanitize-html 2.9
|
|
2
2
|
// Project: https://github.com/punkave/sanitize-html
|
|
3
3
|
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
|
4
4
|
// Afshin Darian <https://github.com/afshin>
|
|
@@ -19,73 +19,81 @@ export = sanitize;
|
|
|
19
19
|
declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
|
|
20
20
|
|
|
21
21
|
declare namespace sanitize {
|
|
22
|
-
|
|
22
|
+
interface Attributes {
|
|
23
|
+
[attr: string]: string;
|
|
24
|
+
}
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
interface Tag {
|
|
27
|
+
tagName: string;
|
|
28
|
+
attribs: Attributes;
|
|
29
|
+
text?: string | undefined;
|
|
30
|
+
}
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
type Transformer = (tagName: string, attribs: Attributes) => Tag;
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
type AllowedAttribute = string | { name: string; multiple?: boolean | undefined; values: string[] };
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
type DisallowedTagsModes = "discard" | "escape" | "recursiveEscape";
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
// tslint:disable-next-line:interface-name
|
|
39
|
+
interface IDefaults {
|
|
40
|
+
allowedAttributes: Record<string, AllowedAttribute[]>;
|
|
41
|
+
allowedSchemes: string[];
|
|
42
|
+
allowedSchemesByTag: { [index: string]: string[] };
|
|
43
|
+
allowedSchemesAppliedToAttributes: string[];
|
|
44
|
+
allowedTags: string[];
|
|
45
|
+
allowProtocolRelative: boolean;
|
|
46
|
+
disallowedTagsMode: DisallowedTagsModes;
|
|
47
|
+
enforceHtmlBoundary: boolean;
|
|
48
|
+
selfClosing: string[];
|
|
49
|
+
}
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
// tslint:disable-next-line:interface-name
|
|
52
|
+
interface IFrame {
|
|
53
|
+
tag: string;
|
|
54
|
+
attribs: { [index: string]: string };
|
|
55
|
+
text: string;
|
|
56
|
+
tagPosition: number;
|
|
57
|
+
mediaChildren: string[];
|
|
58
|
+
}
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
60
|
+
// tslint:disable-next-line:interface-name
|
|
61
|
+
interface IOptions {
|
|
62
|
+
allowedAttributes?: Record<string, AllowedAttribute[]> | false | undefined;
|
|
63
|
+
allowedStyles?: { [index: string]: { [index: string]: RegExp[] } } | undefined;
|
|
64
|
+
allowedClasses?: { [index: string]: boolean | Array<string | RegExp> } | undefined;
|
|
65
|
+
allowedIframeDomains?: string[] | undefined;
|
|
66
|
+
allowedIframeHostnames?: string[] | undefined;
|
|
67
|
+
allowIframeRelativeUrls?: boolean | undefined;
|
|
68
|
+
allowedSchemes?: string[] | boolean | undefined;
|
|
69
|
+
allowedSchemesByTag?: { [index: string]: string[] } | boolean | undefined;
|
|
70
|
+
allowedSchemesAppliedToAttributes?: string[] | undefined;
|
|
71
|
+
allowedScriptDomains?: string[] | undefined;
|
|
72
|
+
allowedScriptHostnames?: string[] | undefined;
|
|
73
|
+
allowProtocolRelative?: boolean | undefined;
|
|
74
|
+
allowedTags?: string[] | false | undefined;
|
|
75
|
+
allowVulnerableTags?: boolean | undefined;
|
|
76
|
+
textFilter?: ((text: string, tagName: string) => string) | undefined;
|
|
77
|
+
exclusiveFilter?: ((frame: IFrame) => boolean) | undefined;
|
|
78
|
+
nestingLimit?: number | undefined;
|
|
79
|
+
nonTextTags?: string[] | undefined;
|
|
80
|
+
/** @default true */
|
|
81
|
+
parseStyleAttributes?: boolean | undefined;
|
|
82
|
+
selfClosing?: string[] | undefined;
|
|
83
|
+
transformTags?: { [tagName: string]: string | Transformer } | undefined;
|
|
84
|
+
parser?: ParserOptions | undefined;
|
|
85
|
+
disallowedTagsMode?: DisallowedTagsModes | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Setting this option to true will instruct sanitize-html to discard all characters outside of html tag boundaries
|
|
88
|
+
* -- before `<html>` and after `</html>` tags
|
|
89
|
+
* @see {@link https://github.com/apostrophecms/sanitize-html/#discarding-text-outside-of-htmlhtml-tags}
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
enforceHtmlBoundary?: boolean | undefined;
|
|
93
|
+
}
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
const defaults: IDefaults;
|
|
96
|
+
const options: IOptions;
|
|
89
97
|
|
|
90
|
-
|
|
98
|
+
function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer;
|
|
91
99
|
}
|
sanitize-html/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/sanitize-html",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "TypeScript definitions for sanitize-html",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sanitize-html",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,6 +67,6 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"htmlparser2": "^8.0.0"
|
|
69
69
|
},
|
|
70
|
-
"typesPublisherContentHash": "
|
|
71
|
-
"typeScriptVersion": "4.
|
|
70
|
+
"typesPublisherContentHash": "c9fcf25c96a87e1cce4619e577412e0c27e81036031ba60e6c49e6459bcc1e2a",
|
|
71
|
+
"typeScriptVersion": "4.5"
|
|
72
72
|
}
|