microsoft / tsdoc

A doc comment standard for TypeScript
https://tsdoc.org/
MIT License
4.7k stars 130 forks source link

Add allowlist for HTML tags and corresponding validation #317

Closed josephjunker closed 2 years ago

josephjunker commented 2 years ago

This is an attempt to address the issue discussed in https://github.com/microsoft/rushstack/issues/2973 . This PR enables the use of an allowedHtmlTags option in TSDoc configs to specify an allowlist of tags. If this option is absent then all HTML tags will be allowed, preserving backwards compatibility. If this option is present then the use of any HTML tags outside of the provided list will signal a parse error.

The allowedHtmlTags option can be inherited from an extended config, but a child config which specifies it will completely overwrite the option from the parent. (The lists will be replaced rather than merged.)