Avalonia.HtmlRenderer icon indicating copy to clipboard operation
Avalonia.HtmlRenderer copied to clipboard

Unexpected blank lines

Open devkcirtap opened this issue 1 year ago • 0 comments

First of all, I would like to thank you for this great library.

When rendering this simple HTML code

<html>
  <body>
    <p><b>Line 1</b><br><b>Line 2</b><br><b>Line 3</b><br><b>Line 4</b></p>
  </body>
</html>

the result looks like current_result

Expected result: expected_result

If I change the block

else if (box.Boxes[i].IsBlock)
{
  followingBlock = true;
}

in the CorrectLineBreaksBlocks method of DomParser.cs to

else if (box.Boxes[i].IsBlock && !box.Boxes[i].IsBrElement)
{
  followingBlock = true;
}

it works, at least for my use case.

devkcirtap avatar Apr 02 '24 15:04 devkcirtap