Repository navigation
Conversation
CDATA is text, but the tokenizer reports it as a comment token, so the beautifier printed it like a tag: on its own line, indented, and with newlines around it. Route CDATA tokens through the text handler so they are placed like the surrounding text. Block-level CDATA that already has its own line keeps it. The HTML beautifier is JavaScript-only, so no Python port is needed.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
main)Fixes Issue: #2365
CDATA is text, but the tokenizer reports it as a comment token, so the beautifier printed it like a tag: on its own line, indented, with newlines around it. That changes rendering for inline content in foreign content (SVG, MathML), where CDATA is the way to include characters that would otherwise be markup:
CDATA tokens are now routed through the text handler, so they are placed like the surrounding text. Block-level CDATA that already sits on its own line keeps its line. CDATA inside
<script>and<style>is read as raw content and is unchanged.Tests are added to
test/data/html/tests.js(HTML is JavaScript-only, so there is no Python port): inline CDATA, the case from the issue, and a block-level CDATA case. Without the change the new cases fail; with it they pass. The full JS source suite passes (39,301 JS / 4,847 CSS / 12,396 HTML tests).Before Merge Checklist