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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom tags are handled in block-formatting context #104

Open
4 tasks
jongio opened this issue Feb 5, 2019 · 5 comments
Open
4 tasks

Custom tags are handled in block-formatting context #104

jongio opened this issue Feb 5, 2019 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jongio
Copy link

jongio commented Feb 5, 2019

馃悰 Bug Report

Whitespace in innerHTML is not preserved.

To Reproduce

When you format this:

<template>
 <div id="app">
  <div id="nav">
   <router-link to="/">Home</router-link> |
   <router-link to="/about">About</router-link>
  </div>
  <router-view />
 </div>
</template>

Expected behavior

The space after Home</router-link> should be preserved.

<template>
 <div id="app">
  <div id="nav">
   <router-link to="/">Home</router-link>|
   <router-link to="/about">About</router-link>
  </div>
  <router-view/>
 </div>
</template>

Context

  • Angular
  • Svelte
  • [x ] Vue
  • Riot
  • HTML5 only

Your Environment

  • Prettyhtml version:
  • NodeJs version: 10.15.1
  • Environment name and version: VS Code1.30.2
    61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
    x64
  • Operating System and version: Windows
@StarpTech StarpTech changed the title Whitespace is removed from innerHTML Custom tags are handled case-insensitive Feb 5, 2019
@StarpTech
Copy link
Member

StarpTech commented Feb 5, 2019

Hi @jongio the reason is that we handle custom-tags in case-insensitive context. I would accept a PR to handle all custom tags as case-sensitive. As a workaround you could do:

<template>
 <div id="app">
  <!--prettyhtml-preserve-whitespace-->
  <div id="nav">
   <router-link to="/">Home</router-link> |
   <router-link to="/about">About</router-link>
  </div>
  <router-view/>
 </div>
</template>

@jongio
Copy link
Author

jongio commented Feb 5, 2019

@StarpTech - Are you saying that the space is removed due to case sensitivity? I'm not following that, but I also don't know the code. To me, not sure that new title describes the issue.

@StarpTech StarpTech changed the title Custom tags are handled case-insensitive Custom tags are handled in block-formatting context Feb 5, 2019
@StarpTech
Copy link
Member

Hi @jongio you're right the title wasn't accurate. For more informations see https://medium.com/@patrickbrosset/when-does-white-space-matter-in-html-b90e8a7cdd33

@stale
Copy link

stale bot commented Feb 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 20, 2019
@stale stale bot closed this as completed Feb 27, 2019
@StarpTech StarpTech added the help wanted Extra attention is needed label Feb 28, 2019
@StarpTech StarpTech reopened this Feb 28, 2019
@stale stale bot removed the wontfix This will not be worked on label Feb 28, 2019
@StarpTech StarpTech added the bug Something isn't working label Sep 11, 2019
@y912765390

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants