-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[fix]: keep space in <pre>
or preserveWhitespace: true
#6990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
<pre>
or preserveWhitespace: true
<pre>
or preserveWhitespace: true
I fixed tests that was failing due to crlf on windows. Would you please run the tests again? |
I don't know how to fix the CI timeout. Can you let me know how to solve it? |
It's unrelated, don't worry about it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks great 👍 Could you replace the test in test/js
with a runtime test inside test/runtime
? You could check the rendered output via target.querySelector('something something').innerHTML
. The advantage would be that these tests are more robust to compiler implementation changes and need less adjustments later on.
Thank you for checking this PR! I will make that change. |
…tejs#6990) Fixes sveltejs#6437 Fixes sveltejs#4731 Closes sveltejs#4737 Whitespace is now untouched inside <pre> tag and other tags if preserveWhitespace is true
…tejs#6990) Fixes sveltejs#6437 Fixes sveltejs#4731 Closes sveltejs#4737 Whitespace is now untouched inside <pre> tag and other tags if preserveWhitespace is true
…tejs#6990) Fixes sveltejs#6437 Fixes sveltejs#4731 Closes sveltejs#4737 Whitespace is now untouched inside <pre> tag and other tags if preserveWhitespace is true
…tejs#6990) Fixes sveltejs#6437 Fixes sveltejs#4731 Closes sveltejs#4737 Whitespace is now untouched inside <pre> tag and other tags if preserveWhitespace is true
…tejs#6990) Fixes sveltejs#6437 Fixes sveltejs#4731 Closes sveltejs#4737 Whitespace is now untouched inside <pre> tag and other tags if preserveWhitespace is true
close #6437
close #4731
This PR fixes to keep the space inside the
<pre>
tag. Also, if the user uses thepreserveWhitespace: true
option, it will keep the space in the same way with or without the<pre>
tag.The previous compiler removes the spaces after the start tag and before the end tag. It works fine in most cases, but it doesn't output as intended inside the
<pre>
tag.However, even after this fix, the space remains removed inside the mustache tag. This is intentional because I think that outputting a lot of space with
{#each}
etc. may be included in the breaking change.There's already a PR #4737 about fixing
preserveWhitespace: true
, but it didn't seem to be active.Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint