Skip to content

Commit a6764cf

Browse files
committed
fix: concate single tag
1 parent 60f598d commit a6764cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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 = [
2828
const ATTRIBUTE_QUOTES_REQUIRED = /[\t\n\f\r "'`=<>]/;
2929

3030
const defaultOptions = {
31-
singleTags: SINGLE_TAGS,
3231
closingSingleTag: undefined,
3332
quoteAllAttributes: true,
3433
replaceQuote: true,
3534
quoteStyle: quoteStyleEnum.Double
3635
};
3736

3837
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+
3944
options = {
4045
...defaultOptions,
41-
...options
46+
...options,
47+
singleTags: st
4248
};
4349

4450
const {

0 commit comments

Comments
 (0)