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
Configure whitespace display css for custom components #5415
Comments
Somewhat related, it would also be nice to declare certain custom components (e.g. |
There might be tons of examples on custom elements that now get treated as standard html, but should be not - not an easy task (examples on vue-i18n): Playground vue-i18n as inline-yaml Playground vue-i18n as inline-json in that case it could help to specify desired <i18n lang="yaml">
en:
welcome: Welcome!
de:
welcome: Willkommen!
</i18n> or <i18n lang="json">
{
"en": {
"welcome": "Welcome!"
},
"de": {
"welcome": "Willkommen!"
}
}
</i18n> still there are a few more special cases imaginable (esp. as some packages/libs might not stick to official html/css specs), which makes me think a simple // 2-cents-end |
It would be helpful if this supported non custom elements as well. In our codebase the styling we use to add custom markers to list items causes them to be whitespace sensitive and currently the only solution to avoid misaligned list items is to set |
@thorn0 What about do not apply |
@evilebottnawi It's already |
This doesn't appear to be documented anywhere. |
It is, just in the page you linked. The initial value for However, applying a pre-safe formatting rule to all custom elements would basically stop prettier from working in a file that makes heavy use of custom elements, e.g. an angular template, because prettier could no longer really format them. That being said, an option for overrides would be really good, but it should probably be easy to use a pre-compiled list (or a combination of them) from dependencies like Prettier currently prints a lot of code like this in our codebase: <nx-card-content>{{
'view.recursionLimitReached.description' | translate
}}</nx-card-content> I think this is pretty hard to read. I would reformat it manually to <nx-card-content>
{{ 'view.recursionLimitReached.description' | translate }}
</nx-card-content> But if the line gets shorter and you later decide to put it into one line by removing the line break, prettier keeps the spaces which makes it ugly again <nx-card-content> {{ 'view' | translate }} </nx-card-content> |
--html-whitespace-sensitivity css
is nice when working with native HTML as it sets the display status properly (most of the time)However, for custom components, it seems to always err on the side of caution and defaults to
inline
.It would be nice if it were possible to set default
display
for custom JSX/NG/Vue? components. This would be nice for codebases where many components may be used in place of HTML elements.Prettier 1.15.1
Playground link
Input:
Output:
The text was updated successfully, but these errors were encountered: