-
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
Edit as HTML should indent my code #12397
Comments
The HTML "beautifier" was intentionally removed. Cc @aduth |
Previously: #7892 It should be noted that there could be different behaviors between what's presented for editing in "Edit as HTML" and what's actually saved as markup of the post. |
That bug seems to indicate that the editor is supposed to preserve whitespace? Because for me it does not. It always runs everything into a single line. |
Going to close this. Once better async load is present there's a willingness to add some more syntax highlighting to HTML editing. |
Bump, this is what I came here for.. it's pretty unthinkable that this hasn't been addressed? Can I help submit a PR or similar? Has anything been drafted for how to address this technically? It sounds like there must be a hook when switching the edit mode to HTML at which point HTML can be beautified if it hasn't. Then thereafter HTML can be preserved as developer left it, or minified if developer makes no edits to HTML. It sounds like technically it may be hard to preserve an "edit version" of a post vs. a minified "publish version" of a post, however. I had to go to a third-party website to beautify my table's HTML which was wild. I am just getting back into WordPress after some years of hiatus. I cannot imagine in the scheme of things whitespace in blocks that users edit is going to have a giant hit on performance when compared to the UX tradeoff currently experienced. CC @mtias |
There are a few mixed things here: how code is stored and how code is presented. For code presentation the best solution was using a proper editor that handled lines and some level code highlight. For saving code the decision was not to touch the source as per #7892. It's certainly possible to beautify on render and not commit unless there are changes. If someone wants to explore that we can look into it. |
When I click on 'Edit as HTML' when on a Gutenberg list block, I see this:
It's be better if the HTML was neatly spaced + indented, like so:
Some images to compare:
Gutenberg visual:
The text was updated successfully, but these errors were encountered: