-
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
Gutenberg wp-block-code adds <br> tags for empty lines within <pre><code> #56855
Comments
Addendum What I meant with
is that 16.9.0 was the first version I noticed markup issues with code blocks (EOL completely missing, everything came on line line). Now with 17.2.0 the |
Thanks for the report. I was also able to confirm this symptom, but I think this behavior is an intentional change. The PR related to this change is #55999, which mentions:
I don't think this behavior is a bug, so I'd like to close this issue, but if there's anything I've missed, please comment. |
Thank you for your reply @t-hamano . Can't say I'm happy with it though... Apparently, it's allowed to use And now I still have to edit every post to fix code blocks, because I guess this isn't getting reversed. |
Is the code block you're using from Gutenberg core? If so, I think this should be fixed on Gutenberg's side. |
Yes, it's the Gutenberg core code block. But I have had "syntax highlighting" plugins installed, so there is no telling what is in my database now :) I removed those plugins a while ago. Just tested it quickly: I do have to edit a code block. First image is how a random posts code block looks, second image is after editing (I added EOL's until
/edit: fixed image order |
Sorry it took so long to reply. I haven't yet had enough time to look into this issue in detail, but I'm wondering if it's an issue with the code block itself, or with a compatibility issue with the plugin extending the code block. I would like to keep this issue open until there is clarity. |
I would like to add this issue to the WP6.5 project board as it might affect many developers. |
Yeah great, @t-hamano . Anything I can do to help / assist? I've been out of the WP dev business quite some time but can always test or something. |
Sorry for getting in touch with you so late. It turns out that the problem you reported has a much larger impact than I expected. A summary of the problem is summarized in #58659. |
I think #58659 covers this issue, so I'd like to close it. |
Description
When adding a code snippet using the code block,
HTML tags are added to the source instead of respecting EOL (end of line) like CRLF/CR.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
The result HTML code is (when using "Copy Element" in Chrome DevTools):
Environment info
WordPress 6.4.2
Gutenberg 17.2.0
Verified with multiple WordPress instances, different syntax highlighting plugins and without. Problem first noticed in Gutenberg version 16.9.0.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: