File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ declare namespace render {
2
+ type Options = {
3
+ /**
4
+ * Custom single tags (selfClosing).
5
+ *
6
+ * @default []
7
+ */
8
+ singleTags : string [ ] | RegExp [ ] ;
9
+
10
+ /**
11
+ * Closing format for single tag.
12
+ *
13
+ * Formats:
14
+ *
15
+ * tag: `<br></br>`, slash: `<br />`, default: `<br>`
16
+ *
17
+ */
18
+ closingSingleTag : "tag" | "slash" ;
19
+
20
+ /**
21
+ * If all attributes should be quoted.
22
+ * Otherwise attributes will be unquoted when allowed.
23
+ *
24
+ * @default true
25
+ */
26
+ quoteAllAttributes : boolean ;
27
+ } ;
28
+
29
+ // PostHTML Tree
30
+ type Tree = Node [ ] ;
31
+ type Node = NodeText | NodeTag ;
32
+ type NodeText = string ;
33
+ type NodeTag = {
34
+ tag : string ;
35
+ attrs ?: Attributes ;
36
+ content ?: Node [ ] ;
37
+ } ;
38
+
39
+ type Attributes = Record < string , string > ;
40
+ }
41
+
42
+ /**
43
+ * Render PostHTML Tree to HTML
44
+ * @param tree PostHTML Tree
45
+ * @param options Render options
46
+ * @returns HTML
47
+ */
48
+ declare function render (
49
+ tree : render . Tree ,
50
+ options ?: Partial < render . Options >
51
+ ) : string ;
52
+
53
+ export = render ;
Original file line number Diff line number Diff line change 5
5
"author" : " Ivan Voischev <voischev.ivan@ya.ru>" ,
6
6
"license" : " MIT" ,
7
7
"main" : " lib/index.js" ,
8
+ "types" : " lib/index.d.ts" ,
8
9
"engines" : {
9
10
"node" : " >=8"
10
11
},
You can’t perform that action at this time.
0 commit comments