HTMLBeautify
HTMLBeautify copied to clipboard
<pre> tags march right with each reformat
Before
<html>
<body>
<pre>
x
x
x
</pre>
</body>
</html>
Reformat 1
Using "Beautify HTML" from the "Edit Menu"
<html>
<body>
<pre>
x
x
x
</pre>
</body>
</html>
The <pre>
is already a little off
Reformat 2
<html>
<body>
<pre>
x
x
x
</pre>
</body>
</html>
My HTMLBeautify.sublime-settings
are empty. Using Sublime Text 3.1.1. Build 3176.
Yeah, I see that if I switch to purely spaces for indentation.
The script uses tab characters to re-indent, and Sublime Text automatically converts the tabs to spaces if that is how your settings are set up… You can test things working properly if you switch/convert to tab-indentation temporarily, then run the script.
It will would be great to update the script to read the user indentation settings (tab vs. spaces) then, use that method of indenting to prevent the behavior you have mentioned. (I am currently pretty busy with paying work, so I can't devote time to it yet!)
The unsatisfying workaround is to add <pre>
to the ignore
settings:
// indicates tags whose contents should be ignored (add more as needed)
"ignored_tag_opening" : "<script|<style|<!--|{\\*|<\\?php|<pre",
// indicates when to stop ignoring
"ignored_tag_closing" : "</script|</style|-->|\\*}|\\?>|</pre",
Doh, just noticed that still also indents the contents of <pre>
. Grrrr.
I'll take a look at this and see if I can adjust this soon.
Yes I noticed that too, that sometimes indentation and newlines would be gone. But sometimes also not (like above). But I couldn't really figure out when and why. Ignoring the contents actually sounds right to me.