question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

close tag of A span multi lines

See original GitHub issue

Prettier 1.15.1 Playground link

--parser html

Input:

<div id="error_sample"><a href="/coop.html">aaaaa</a><a href="/coop.html">my close tag span multi line</a><a href="/coop.html">aaaaa</a></div>
<div id="ok_sample"><a href="/coop.html">aaaaa</a> <a href="/coop.html">has whitesapce around me, i'am ok</a> <a href="/coop.html">aaaaa</a></div>

<a href="/coop.html">this is a long long long long long long long long long long long line</a>
<div class="halo">this is a long long long long long long long long long long long line</div>

Output:

<div id="error_sample">
  <a href="/coop.html">aaaaa</a
  ><a href="/coop.html">my close tag span multi line</a
  ><a href="/coop.html">aaaaa</a>
</div>
<div id="ok_sample">
  <a href="/coop.html">aaaaa</a>
  <a href="/coop.html">has whitesapce around me, i'am ok</a>
  <a href="/coop.html">aaaaa</a>
</div>

<a href="/coop.html"
  >this is a long long long long long long long long long long long line</a
>
<div class="halo">
  this is a long long long long long long long long long long long line
</div>

Expected behavior: see the output above, ‘#ok_sample’

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hawkrivescommented, Nov 10, 2018

@hisland It’s because <a> is an inline tag, so if Prettier added whitespace to the HTML it would show up in your browser – see https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting for more detail

0reactions
paolovaninicommented, Nov 13, 2018

@ikatyang : the option you suggested seems to resolve my problems with the closing tags:. –html-whitespace-sensitivity ignore (and I learned a lot about the spec of a closing ‘a’ tag and white-spacing too 😉) Thanks for your help! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiline span-behaving elements - css - Stack Overflow
I want to display a list of complex, but fixed-size multiline elements, assuming that they will wrap the ...
Read more >
How can I wrap my text to span over multiple lines in order to ...
I need to create a version where the text is wrapped within the "fakeScreen" container and can span across multiple lines.
Read more >
WebD2: Common HTML Tags - University of Washington
An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text...
Read more >
HTML span Tag - GeeksforGeeks
The span tag is a paired tag means it has both open(<) and closing (>) tags, and it is mandatory to close the...
Read more >
The Content Span element - HTML - MDN Web Docs
It should be used only when no other semantic element is appropriate. <span> is very much like a <div> element, but <div> is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found