You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{-# LANGUAGE OverloadedStrings #-}
moduleTestwhereimportText.Blaze.Html5asHimportText.Blaze.Html5.AttributesasAimportText.Blaze.Html.Renderer.Pretty
example =putStr$ renderHtml $ docTypeHtml $doH.head$do
meta ! charset "utf-8"H.title "Test"
body $ pre $do"Text"H.a $"Text inside tag""More text"
The resulting output:
<!DOCTYPE HTML><html><head><metacharset="utf-8"><title>
Test
</title></head><body><pre>
Text
<a>
Text inside tag
</a>
More text
</pre></body></html>
When the pre tag is used whitespace is significant, so I consider the output above to be incorrect. If the String renderer is used, then the output is better:
The xhtml library handles this problem by inserting whitespace inside the tags (</a\n >). Perhaps you could do the same. (Or at least document that the pretty output is broken.)
The text was updated successfully, but these errors were encountered:
I stumbled over this as well. I guess it could be improved by having a list of tags where it shouldn’t create linebreaks.
I also noticed that when you have nested Append constructors, it will add linebreaks, leading to extra spaces in appended Content constructors (e.g. if you have Append (Content "foo") (Content "bar") it renders as foo bar instead of foobar.
This is especially crucial for https://hackage.haskell.org/package/ihp-hsx, which creates Appends for interpolated variables, so if I interpolate say let x = "x" in [hsx|foo ({x})|] the result will be "foo ( x )" instead of "foo (x)".
Consider the following code:
The resulting output:
When the pre tag is used whitespace is significant, so I consider the output above to be incorrect. If the String renderer is used, then the output is better:
The xhtml library handles this problem by inserting whitespace inside the tags (
</a\n >
). Perhaps you could do the same. (Or at least document that the pretty output is broken.)The text was updated successfully, but these errors were encountered: