Closed
Description
The spacing in preformatted text should be maintained.
To reproduce
import xhtm from 'xhtm'
import vhtml from 'vhtml'
const html = xhtm.bind(vhtml)
const markup = html`
<pre>
███ ███
███░ ░░░███
███░ ████████ ████████ ██████ ░░░███
███░ ░░███░░███░░███░░███ ███░░███ ░░░███
░░░███ ░███ ░███ ░███ ░░░ ░███████ ███░
░░░███ ░███ ░███ ░███ ░███░░░ ███░
░░░███ ░███████ █████ ░░██████ ███░
░░░ ░███░░░ ░░░░░ ░░░░░░ ░░░
░███
█████
░░░░░
</pre>
`
console.log(markup)
What should render
<pre>
███ ███
███░ ░░░███
███░ ████████ ████████ ██████ ░░░███
███░ ░░███░░███░░███░░███ ███░░███ ░░░███
░░░███ ░███ ░███ ░███ ░░░ ░███████ ███░
░░░███ ░███ ░███ ░███ ░███░░░ ███░
░░░███ ░███████ █████ ░░██████ ███░
░░░ ░███░░░ ░░░░░ ░░░░░░ ░░░
░███
█████
░░░░░
</pre>
What actually renders
███ ██████░ ░░░██████░ ████████ ████████ ██████ ░░░██████░ ░░███░░███░░███░░███ ███░░███ ░░░███░░░███ ░███ ░███ ░███ ░░░ ░███████ ███░░░░███ ░███ ░███ ░███ ░███░░░ ███░░░░███ ░███████ █████ ░░██████ ███░░░░ ░███░░░ ░░░░░ ░░░░░░ ░░░░████████░░░░░
Looks like this is due to the indentation fix at https://github.com/dy/xhtm/blob/master/htm.js#L90 but that seems to set expectations for the parsing in other places as merely removing it leads to other issues.
Metadata
Metadata
Assignees
Labels
No labels