Skip to content
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

<pre> tags march right with each reformat #57

Open
codeon-nat opened this issue Oct 8, 2018 · 3 comments
Open

<pre> tags march right with each reformat #57

codeon-nat opened this issue Oct 8, 2018 · 3 comments
Assignees

Comments

@codeon-nat
Copy link

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.

@codeon-nat codeon-nat changed the title <pre> tags march right with each reformat <pre> tags march right with each reformat Oct 8, 2018
@rareyman
Copy link
Owner

rareyman commented Oct 8, 2018

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",

@rareyman
Copy link
Owner

rareyman commented Oct 8, 2018

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.

@codeon-nat
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants