2

I'm attempting to use the Tidy2 plugin within Notepad++ to auto-format some HTML for prettiness. However, Tidy2 keeps adding HTML tags to my code, which would break the site functionality since I'm using PHP includes. Anyway, this:

<div class="form-group">
  <label class="col-md-4 control-label" for="RC_Contract">Contract</label>
  <div class="col-md-4">
    <select id="RC_Contract" name="RC_Contract" class="form-control">
      <option value="1">2 Year</option>
      <option value="2">None</option>
    </select>
  </div>
</div>

turns into this after using Tidy2:

<html>
    <head>
        <meta name="generator" content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
        <title></title>
    </head>
    <body>
        <div class="form-group">
            <label class="col-md-4 control-label" for="RC_Contract">Contract</label>
            <div class="col-md-4">
                <select id="RC_Contract" name="RC_Contract" class="form-control">
                    <option value="1">2 Year</option>
                    <option value="2">None</option>
                </select>
            </div>
        </div>
    </body>
</html>

2 Answers 2

2

This unwanted advertising makes Tidy2 a piece of crap. For all those who are still stranding at this question: Try out "XML Tools" and it's pretty print option.

https://stackoverflow.com/a/8786249/2306536

Sign up to request clarification or add additional context in comments.

2 Comments

I agree it's very annoying and kind of defeats the purpose of a quick html prettifier, since you then have to go and delete tags and unindent 2 layers.
Currently I am simply using Eclipse to edit .xml files, I have it open all day long anyways.
-2

Use Tidy2 when your code is UNTIDY. Your primary code didn't have any code style problem. I really suggest you to use some tools like HTMLPAD for keeping your code style pretty from the beginning of coding. In case you use nice editors with good autocomplete you won't need any tools to make it tidy!

2 Comments

I'm really only using the Tidy2 feature to fix auto-indent issues. You're right, my code isn't Untidy - as in, everything is on the correct line. But it is spaced incorrectly from the left of the screen. There are a number of tabs(spaces) from the left of the file which you cannot see in my copy-pasted code on this site. Is it possible to auto-indent HTML, Javascript, and PHP with Notepad++?
as I said before the best solution is to write you code in a nice and easy-to-config IDE like PHPstorm. these IDEs have some configuration to have auto-indent during your coding. and you can config it as the way you like.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.