Notepad++ XML Tools Autospacing Logic

291 views Asked by At

PLEASE HELP ME

So I started using the CTRL+ALT+SHIFT+B autospacing feature that comes with the XML Tools plugin using Notepad++ v7.2. Everything is working fine I just have a question about the logic the plugin uses. In this excerpt of code:

                    <tr>
                        <td>
                            <img id="codeImg" alt="matrix code" src="http://i860.photobucket.com/albums/ab170/gondrongsolo/background.gif">
                            </td>
                            <td>
                                <ul>
                                    <li>
                                        <em>Python</em> programming</li>
                                    <li>Shell scripting</li>
                                    <li>Reddit addict</li>
                                    <li>Fitness nut</li>
                                    <li>Raidboss Gamer</li>
                                </ul>
                            </td>
                        </tr>

Why does using the autospacing feature correct it like this? Shouldn't the first <tr> match the same spacing with the </tr> closing tag? I'm finding this happens everything I inserted a tag that doesn't need a closing tag, such as img or p tags.

I would really like to be able to fix the auto formatting because it allows me to read my code more clearly and would greatly appreciate a response. If I need a different plugin please direct me!

1

There are 1 answers

0
ASwiftPeregrine On BEST ANSWER

So despite the fact you do not need to make img a self closing tag in order to use it in html, you can use it at the end of the tag. If using this plugin you can make it happy when you do <img ... /> without causing errors on the web page. The plugin will read this correctly then and fix the issue resulting in the following formatting:

                     <tr>
                        <td>
                            <img id="codeImg" alt="matrix code" src="http://i860.photobucket.com/albums/ab170/gondrongsolo/background.gif"/>
                        </td>
                        <td>
                            <ul>
                                <li>
                                    <em>Python</em> programming</li>
                                <li>Shell scripting</li>
                                <li>Reddit addict</li>
                                <li>Fitness nut</li>
                                <li>Raidboss Gamer</li>
                            </ul>
                        </td>
                    </tr>