Configure whitespace display css for custom components
See original GitHub issue--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
--parser angular
Input:
<div>
Something
</div>
<span>
Something
</span>
<custom-inline>
Something
</custom-inline>
<custom-block>
Something Else
</custom-block>
<!-- display: block -->
<custom-block>
Something Else
</custom-block>
<!-- it would be nice to set custom-block as "block" always -->
Output:
<div>Something</div>
<span> Something </span>
<custom-inline> Something </custom-inline>
<custom-block> Something Else </custom-block>
<!-- display: block -->
<custom-block>Something Else</custom-block>
<!-- it would be nice to set custom-block as "block" always -->
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:7 (2 by maintainers)
Top Results From Across the Web
white-space - CSS: Cascading Style Sheets - MDN Web Docs
The white-space CSS property sets how white space inside an element is handled.
Read more >Using White Space For Readability In HTML And CSS
White Space Readability Well-written, readable code doesn't create mind games and labyrinths when other developers read it.
Read more >Fighting the Space Between Inline Block Elements | CSS-Tricks
One is to use a custom font with spaces character of zero width; should be working fine and I think we can easily...
Read more >How to remove the space between inline/inline-block elements?
It's called a custom font with zero-width spaces, which allows you to collapse the whitespace (added by the browser for inline elements when...
Read more >4 Easy Ways to Insert Spaces in HTML - HubSpot Blog
However, if you want to add space for styling purposes (for instance, whitespace between elements), we recommend using CSS instead — jump to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
lang
asor
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
--html-ignore: i18n,custom-block
option is the only common workaround and maybe even fastes to implement?// 2-cents-end
@evilebottnawi It’s already
strict
(inline
) for custom (unknown) elements. So this issue is about your second step.