-
Notifications
You must be signed in to change notification settings - Fork 21
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
Allow one blank line between elements at the same level #43
Comments
Hi @gertqin thank you for your proposal. I agree that it could help for some scenarios but I'm not convinced. Can you show me some real examples? Can you link me to the prettier option? |
Hi @StarpTech, thanks for considering the proposal :) While I agree with you, that if you can keep your html components small enough this would not be needed. But in bigger applications this can be hard to achieve. As an example here is (a bit simplified) vue component from one of my projects: <div class="smart-table">
<div class="smart-table-header">
<slot name="header"/>
</div>
<template v-for="item in items">
<div class="smart-table-item" :key="item.id">
<slot name="item" :item="item"/>
</div>
<transition name="slide-down">
<div v-if="isItemSelected(item)" class="smart-table-foldout">
<slot name="foldout" :item="item" />
</div>
</transition>
</template>
<div class="smart-table-placeholder">
<slot name="placeholder"></slot>
</div>
</div> Here the blank lines separates the header, item and placeholder sections, which I think makes the component more readable. As for prettier, it is not an option - it is just part of their "rationale": https://prettier.io/docs/en/rationale.html#empty-lines |
@gertqin I'm fine with your proposal. Would you mind to a create a PR? |
Hi :) I tried to get a stab at #43 I'm really not sure it's done the best it could be, but it sounds decent. If you think of a better way, or at least better names, please tell me. I didn't know if you wanted this feature behind an option. It's still possible.
Fixed in #58 |
🚀 Feature Proposal
Like prettier allows one blank line between statements in the same scope, prettyhtml could also allow one blank line between elements at the same level (potentially as a configuration option).
Motivation
It can improve readability of long html.
Example
This would then be allowed:
where as
should become
The text was updated successfully, but these errors were encountered: