COMP1010UNSW / pyhtml-enhanced

A library for building HTML documents with a simple and learnable syntax
https://comp1010unsw.github.io/pyhtml-enhanced/
MIT License
4 stars 1 forks source link

The contents of `<pre>` tag element is indented incorrectly #39

Closed MaddyGuthridge closed 4 months ago

MaddyGuthridge commented 6 months ago

The contents of <pre> is rendered by browsers with whitespace as-is. As such, pyhtml-enhanced's automatic indentation causes content to appear incorrectly.

import pyhtml as p

print(
    p.html(
        p.pre(
            "Example text"
        )
    )
)

Expected output

<html>
  <pre>Example text</pre>
</html>

Actual output

<html>
  <pre>
    Example text
  </pre>
</html>

Notes

This also affects <textarea> tags.

To fix

Fixing this requires a significant refactoring of the rendering system, so I might not do so soon.

MaddyGuthridge commented 4 months ago

Fixed in v2.1.0