File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ type Node = NodeText | NodeTag & {
5
5
closeAs ?: closingSingleTagTypeEnum ;
6
6
} ;
7
7
8
- const SINGLE_TAGS = [
8
+ const SINGLE_TAGS : Array < string | RegExp > = [
9
9
'area' ,
10
10
'base' ,
11
11
'br' ,
@@ -28,17 +28,23 @@ const SINGLE_TAGS = [
28
28
const ATTRIBUTE_QUOTES_REQUIRED = / [ \t \n \f \r " ' ` = < > ] / ;
29
29
30
30
const defaultOptions = {
31
- singleTags : SINGLE_TAGS ,
32
31
closingSingleTag : undefined ,
33
32
quoteAllAttributes : true ,
34
33
replaceQuote : true ,
35
34
quoteStyle : quoteStyleEnum . Double
36
35
} ;
37
36
38
37
function render ( tree ?: Node | Node [ ] , options : Options = { } ) : string {
38
+ let st = SINGLE_TAGS ;
39
+
40
+ if ( options . singleTags ) {
41
+ st = [ ...new Set ( [ ...SINGLE_TAGS , ...options . singleTags ] ) ] ;
42
+ }
43
+
39
44
options = {
40
45
...defaultOptions ,
41
- ...options
46
+ ...options ,
47
+ singleTags : st
42
48
} ;
43
49
44
50
const {
You can’t perform that action at this time.
0 commit comments