New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore CDATA in HTML or option to ignore it #16147
Comments
@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
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 |
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.
The text was updated successfully, but these errors were encountered: