@@ -41,6 +41,8 @@ interface IConfigJson {
41
41
noStandardTags ?: boolean ;
42
42
tagDefinitions ?: ITagConfigJson [ ] ;
43
43
supportForTags ?: { [ tagName : string ] : boolean } ;
44
+ supportedHtmlElements ?: string [ ] ;
45
+ reportUnsupportedHtmlElements ?: boolean ;
44
46
}
45
47
46
48
/**
@@ -69,6 +71,8 @@ export class TSDocConfigFile {
69
71
private readonly _tagDefinitions : TSDocTagDefinition [ ] ;
70
72
private readonly _tagDefinitionNames : Set < string > ;
71
73
private readonly _supportForTags : Map < string , boolean > ;
74
+ private _supportedHtmlElements : Set < string > | undefined ;
75
+ private _reportUnsupportedHtmlElements : boolean | undefined ;
72
76
73
77
private constructor ( ) {
74
78
this . log = new ParserMessageLog ( ) ;
@@ -167,6 +171,18 @@ export class TSDocConfigFile {
167
171
return this . _supportForTags ;
168
172
}
169
173
174
+ public get supportedHtmlElements ( ) : ReadonlyArray < string > | undefined {
175
+ return this . _supportedHtmlElements && Array . from ( this . _supportedHtmlElements ) ;
176
+ }
177
+
178
+ public get reportUnsupportedHtmlElements ( ) : boolean | undefined {
179
+ return this . _reportUnsupportedHtmlElements ;
180
+ }
181
+
182
+ public set reportUnsupportedHtmlElements ( value : boolean | undefined ) {
183
+ this . _reportUnsupportedHtmlElements = value ;
184
+ }
185
+
170
186
/**
171
187
* Removes all items from the `tagDefinitions` array.
172
188
*/
@@ -217,6 +233,23 @@ export class TSDocConfigFile {
217
233
this . _tagDefinitions . push ( tagDefinition ) ;
218
234
}
219
235
236
+ /**
237
+ * Adds a new item to the `supportedHtmlElements` array.
238
+ */
239
+ public addSupportedHtmlElement ( htmlElement : string ) : void {
240
+ if ( ! this . _supportedHtmlElements ) {
241
+ this . _supportedHtmlElements = new Set ( ) ;
242
+ }
243
+ this . _supportedHtmlElements . add ( htmlElement ) ;
244
+ }
245
+
246
+ /**
247
+ * Removes the explicit list of allowed html elements.
248
+ */
249
+ public clearSupportedHtmlElements ( ) : void {
250
+ this . _supportedHtmlElements = undefined ;
251
+ }
252
+
220
253
/**
221
254
* Removes all entries from the "supportForTags" map.
222
255
*/
@@ -334,6 +367,15 @@ export class TSDocConfigFile {
334
367
} ) ;
335
368
}
336
369
370
+ if ( configJson . supportedHtmlElements ) {
371
+ this . _supportedHtmlElements = new Set ( ) ;
372
+ for ( const htmlElement of configJson . supportedHtmlElements ) {
373
+ this . addSupportedHtmlElement ( htmlElement ) ;
374
+ }
375
+ }
376
+
377
+ this . _reportUnsupportedHtmlElements = configJson . reportUnsupportedHtmlElements ;
378
+
337
379
if ( configJson . supportForTags ) {
338
380
for ( const tagName of Object . keys ( configJson . supportForTags ) ) {
339
381
const supported : boolean = configJson . supportForTags [ tagName ] ;
@@ -553,6 +595,12 @@ export class TSDocConfigFile {
553
595
configFile . setSupportForTag ( tagDefinition . tagName , true ) ;
554
596
}
555
597
598
+ for ( const htmlElement of configuration . supportedHtmlElements ) {
599
+ configFile . addSupportedHtmlElement ( htmlElement ) ;
600
+ }
601
+
602
+ configFile . reportUnsupportedHtmlElements = configuration . validation . reportUnsupportedHtmlElements ;
603
+
556
604
return configFile ;
557
605
}
558
606
@@ -591,6 +639,14 @@ export class TSDocConfigFile {
591
639
} ) ;
592
640
}
593
641
642
+ if ( this . supportedHtmlElements ) {
643
+ configJson . supportedHtmlElements = [ ...this . supportedHtmlElements ] ;
644
+ }
645
+
646
+ if ( this . _reportUnsupportedHtmlElements !== undefined ) {
647
+ configJson . reportUnsupportedHtmlElements = this . _reportUnsupportedHtmlElements ;
648
+ }
649
+
594
650
return configJson ;
595
651
}
596
652
@@ -712,6 +768,16 @@ export class TSDocConfigFile {
712
768
} ) ;
713
769
}
714
770
} ) ;
771
+
772
+ if ( this . supportedHtmlElements ) {
773
+ configuration . setSupportedHtmlElements ( [ ...this . supportedHtmlElements ] ) ;
774
+ }
775
+
776
+ if ( this . _reportUnsupportedHtmlElements === false ) {
777
+ configuration . validation . reportUnsupportedHtmlElements = false ;
778
+ } else if ( this . _reportUnsupportedHtmlElements === true ) {
779
+ configuration . validation . reportUnsupportedHtmlElements = true ;
780
+ }
715
781
}
716
782
717
783
private _getNoStandardTagsWithExtends ( ) : boolean {
0 commit comments