Template literals serve a wide range of use-cases in string formatting.
This has led to situations where these strings span a larger number of lines and become more complicated as well.
Currently you cannot place documentation directly inside a template string, because a template literal variable requires an expression to be provided. For example, the following is illegal:
const query = `a & b ${/* comment */} & c & d`;
As a minimal workaround, you need can inject through ${'' /* comment after empty string */}
.
Comments would allow you to document segments of a (large or complex) template string, without having to split up the string into multiple parts (e.g. variables). Which introduces naming problems, dislocates the string order and/or requires multiple separate template-concattenations to occur (which may not be possible if a specialized template tag function is used).