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
Issue:
When using renderToString(vdom, {}, { pretty: true }), text nodes that normally do not have whitespace between it and its siblings are rendered on a newline, which can create undesirable whitespace issues.
/** @jsx h */import{h}from'preact';importrenderToStringfrom'preact-render-to-string';functionText(){return(<p>
Lorem ipsum <a>click me</a>. Dolor sit amet.
</p>);}consthtml=renderToString(<Text/>,{},{pretty: true});console.log(html);
console.log output:
<p>
Lorem ipsum
<a>click me</a>
. Dolor sit amet.
</p>
Proposed resolution:
When there is no explicit whitespace between a text node and its sibling, the pretty renderer should keep the output on the same line. For the example above, I'd expect an output of:
<p>
Lorem ipsum
<a>click me</a>. Dolor sit amet.
</p>
The text was updated successfully, but these errors were encountered:
Issue:
When using
renderToString(vdom, {}, { pretty: true })
, text nodes that normally do not have whitespace between it and its siblings are rendered on a newline, which can create undesirable whitespace issues.Minimal sample project with the issue:
https://stackblitz.com/edit/js-imcswy?file=index.js
Sample code:
console.log output:
Proposed resolution:
When there is no explicit whitespace between a text node and its sibling, the pretty renderer should keep the output on the same line. For the example above, I'd expect an output of:
The text was updated successfully, but these errors were encountered: