How To Auto-Format / Indent XML/HTML in Notepad++
It's been the third time that I install Windows and npp and after some time I realize the tidy function no longer work. So I google for a solution, come to this thread, then with the help of few more so threads I finally fix it. I'll put a summary of all my actions once and for all.
Install TextFX plugin: Plugins -> Plugin Manager -> Show Plugin Manager. Select TextFX Characters and install. After a restart of npp, the menu 'TextFX' should be visible. (credits: @remipod).
Install libtidy.dll by pasting the Config folder from an old npp package: Follow instructions in this answer.
After having a Config folder in your latest npp installation destination (typically C:\Program Files (x86)\Notepad++\plugins), npp needs write access to that folder. Right click Config folder -> Properties -> Security tab -> select Users, click Edit -> check Full control to allow read/write access. Note that you need administrator privileges to do that.
Restart npp and verify TextFX -> TextFX HTML Tidy -> Tidy: Reindent XML works.
For those who don't know, npp has a lot of support from plugins and other projects. You can download those plugins from SourceForge.
You need XML Tools
to format your text in n++
After you have downloaded XML Tools
..
Exit Notepad++
Go To C:\Program File\Notepad++
.... Your N++ installed folder.
- Place below files from xml tools which you downloaded in the npp root folder by
copy replace
- Go To
..\Plugins
subfolder and place below downloaded file
Restart and enjoy!!!
Ctrl + Alt + Shft + B to format.
Since I upgraded to 6.3.2, I use XML Tools
.
- install XML Tools via the Plugin Admin (Plugins → Plugins Admin... Then search for "XML Tools", check its box and click the "Install" button).
- use the shortcut Ctrl+Alt+Shift+B (or menu → Plugins → XML Tools → Pretty Print)
In older versions: menu → TextFX → HTML Tidy → Tidy: Reindent XML.
Install Tidy2 plugin. I have Notepad++ v6.2.2, and Tidy2 works fine so far.