Open muuvmuuv opened 7 months ago
@muuvmuuv Thanks for the report. I am not familiar with CDATA so let me ask a question. Is this a matter of code style preference? Or is there some processor or other that cannot accept the current Prettier output?
If it is a matter of style preference, we would not accept this request.
From MDN
used within XML to include extended portions of unescaped text Since you cannot write HTML in HTML that is printed as “plain text” you need that unless you escape/ASCII the HTML tags yourself which is time-consuming.
It is a matter of style pref, but this isn't directly tied to Angular. CDATA is unformatted unescaped unstyled plain text. IMO, it should not get any formatting. You style the inner part of yourself.
Another quote: https://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean
I agree that CDATA
should not be formatted.
Hi! I am working on this issue, can you please assign it to me? Thanks!
Hey @yanapeycheva, great!
I wouldn't say this is only for Angular but any XML.
Prettier 3.2.5 Playground link
Input:
Output:
Expected output:
Why?
We use CDATA to show a code example of how someone should use a component surrounded by pre/code tags. Prettier always formats it. Alternatively, handle it separately and do not try to indent it with the rest of the code.