Skip to content
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

Prettyhtml should not put multiple tags into the same line #90

Closed
1 task done
octref opened this issue Dec 12, 2018 · 2 comments
Closed
1 task done

Prettyhtml should not put multiple tags into the same line #90

octref opened this issue Dec 12, 2018 · 2 comments

Comments

@octref
Copy link
Contributor

octref commented Dec 12, 2018

Before you submit an issue we recommend you drop into the Gitter community and ask any questions you have or mention any problems you've had getting started with prettyhtml.

🐛 Bug Report

vuejs/vetur#1018
Related: prettier/prettier#5596

When user explicitly choose to put elements in multiple lines, prettyhtml should not put them in the same line (and break whitespace).

To Reproduce

Steps to reproduce the behavior: Format it in https://prettyhtml.netlify.com/

Paste your markup here:

<h1>
  404
  <template v-if="resource">
    the {{ resource }} was
  </template>
  not found
</h1>

Expected behavior

Whitespace is preserved.

Paste the results here:

<h1>
  404
  <template v-if="resource">
    the {{ resource }} was
  </template>
  not found
</h1>

Instead the result is:

<h1>
  404
  <template v-if="resource">the {{ resource }} was</template>not found
</h1>

which could render as "wasnot found" in the end.

Context

  • Vue

Your Environment

Latest on https://prettyhtml.netlify.com.

@StarpTech
Copy link
Member

Hi @octref thanks for the bug report. The current behavior is correct but this is tricky because the template tag isn't whitespace sensitive but when it will be replaced it will create a different result. I think we should add the template tag to the list so that the nodes are handled as not collapsable.

@octref
Copy link
Contributor Author

octref commented Dec 12, 2018

That makes sense to me. Thanks!

StarpTech added a commit that referenced this issue Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants