-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Serializer: Remove HTML beautification, preserve whitespace #7892
Conversation
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.
Rebased against master. @danielbachhuber The tests added in 6ae7a11 specifically target multi-line shortcode (the shortcode block is already a |
Ok, great.
Could you add one more test for |
I don't think that falls within the scope of what this pull request is targeting. Raw handling is a different feature than the serialization beautifier. |
Ok. I still think it would be a helpful test to have to truly fix #4456. Would you like me to add the test when I have a moment? |
That's fine. I guess I'm unclear about what's specifically not covered already to address #4456 . The classic editor content issue is already fixed (on master), and this one resolves issues with shortcode block (with tests). There's nothing in the original report that touches |
@aduth Ok. I'll defer to your better judgement for this PR, and follow up with a second PR for anything I think of. |
And such was the way beauty left our world... |
Supersedes #6716
Fixes #4456
This pull request seeks to remove in-block HTML beautification. Per intent with #633, there are still newlines between blocks. Within a block, however, the default serialization will not inject any of its own automated whitespace or tabbing. Existing intentional whitespace will be preserved (e.g. code blocks, shortcode blocks).
This has a few benefits:
js-beautify
accounts for 48kb (18.1kb gzipped), now removedchildren
parse would include (often wrongly) text nodes not always intended but automatically injected by beautifieradding-blocks
E2E test which would have previously failed in master (see bd78d55)test/integration/fixtures
output files, e.g.apple-out.html
table block)Implementation notes:
The vast majority of affected file changes are fixture updates. The only meaningful changes are those made within
blocks/api/serializer.js
, though fixtures verification would be good as well.Testing instructions:
Verify there are no issues with serializing and restoring block contents.
Examples: