During chapter loads, xmlprettify is called to format the output nicely, and in doing so it strips the text and tail attributes from elements. Unfortunately this can have the unintended consequence of producing mangled epubs from reasonable HTML.
For example, this HTML:
<div>1234 <i>5</i> 6789</div>
should produce output exactly like the input,
<div>1234 <i>5</i> 6789</div>

but actually looks like:
<div>1234
<i>5</i>6789
</div>

Which will be rendered differently since there's no space after the 5.
Removing the xmlprettify call from Chapter._render makes the output correct again.
During chapter loads,
xmlprettifyis called to format the output nicely, and in doing so it strips thetextandtailattributes from elements. Unfortunately this can have the unintended consequence of producing mangled epubs from reasonable HTML.For example, this HTML:
should produce output exactly like the input,
but actually looks like:
Which will be rendered differently since there's no space after the 5.
Removing the xmlprettify call from
Chapter._rendermakes the output correct again.