WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

white-space: pre-wrap wraps spans prematurely

Open nnsee opened this issue 1 year ago • 1 comments

Hi there! Spans seem to be wrapped to a new line in their entirety when white-space: pre-wrap is set.

Repro code:

<style>
.highlight {
  background-color: #ffff00;
}
code {
  white-space: pre-wrap;
  display: block;
  max-width: 250px;
}
</style>
<code>
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
</code>
<hr>
<code>
00 00 00 00 00 00 00 00 00 00 <span class="highlight">00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</span> 00 00 00 00 00
</code>

WeasyPrint output:

Image

Expected output:

Image

Not quite sure why this is happening or how to stop it from happening.

nnsee avatar Nov 22 '24 15:11 nnsee

Thanks for the report. That’s probably related to #2025.

liZe avatar Nov 24 '24 12:11 liZe