Configure whitespace display css for custom components
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
--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 -->
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Prettier Playground example using --parser angular and reproduce the displayed whitespace behavior for native and custom elements. Determine how a configurable default display value for custom JSX, Angular, or Vue components should be specified, then verify that the example preserves block-like and inline-like formatting as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, css, javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100