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 & {
55 closeAs ?: closingSingleTagTypeEnum ;
66} ;
77
8- const SINGLE_TAGS = [
8+ const SINGLE_TAGS : Array < string | RegExp > = [
99 'area' ,
1010 'base' ,
1111 'br' ,
@@ -28,17 +28,23 @@ const SINGLE_TAGS = [
2828const ATTRIBUTE_QUOTES_REQUIRED = / [ \t \n \f \r " ' ` = < > ] / ;
2929
3030const defaultOptions = {
31- singleTags : SINGLE_TAGS ,
3231 closingSingleTag : undefined ,
3332 quoteAllAttributes : true ,
3433 replaceQuote : true ,
3534 quoteStyle : quoteStyleEnum . Double
3635} ;
3736
3837function 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+
3944 options = {
4045 ...defaultOptions ,
41- ...options
46+ ...options ,
47+ singleTags : st
4248 } ;
4349
4450 const {
You can’t perform that action at this time.
0 commit comments