auto-ident function in html page
-
Hi all, the auto-ident function does not work on my simple html page.
Any hint? -
-
the built in auto indent of notepad++ does not indent your html tags, but it keeps the indentation at the tab level you used on the previous line.
if you want to automatically indent, or clean up your indents, you will need to use one of the indentation or tidy up plugins.in this example i use indent by fold 0.7.1, which you can install either manually, or automatically using the built in “plugins admin” of the current notepad++ version 7.6.3, or “plugin manager” on versions 7.5.9 and below.
- install the plugin “ident by fold”
- open a html file, or create any unformatted html code
here is a screenshot of unindented html code:
- now go to the menu
plugins > indent by fold > reindent file
, and your code will be correctly indented
note: indent by fold works completely without an own parser, independent of any programming languages, as it uses the folding information of any built in or custom lexer or even user defined languages. it will work on any language, as long as the folding structure of the lexer or udl is set correctly. 👍
this time i don’t agree with you … (yeeeeyh 😄 )
-
this question was correctly posted at general discussion.
(i will overlook his double posting at “help wanted”) -
this is a direct question to the notepad++ built in auto-indent feature, which does autoindent for eg. c++ and php functions.
-
@Adriano-Ellero was very polite, understanding and responsive so far, even after having been served by our man of few words 😉
-
Dear Meta Chuh
I found out right now that “indent by fold” works perfectly.
But I tried all day to make it running on 64bit notepad++ version. No way! It works only on 32bit version.
I spent all day trying other solutions and plugins, looking into internet articles without understanding why I was not able to to install any of them.
Astonished why nobody mentioned 32/64 version plugins compatibility. Why it is not published on the plugin list?
Anyway really thanks a lot for your suggestion and for your kindness.
-
thank you for your reply @Adriano-Ellero
I found out right now that “indent by fold” works perfectly. But I tried all day to make it running on 64bit notepad++ version. No way! It works only on 32bit version.
don’t worry, “indent by fold” was only one example of the many plugins that do the same.
note: we do not know, which notepad++ version or architecture you are using, and there are many differences between them.
best practice is to always provide us with your debug info, so that we can adapt any guides for any specific version in use.
(you can find your debug info at? > debug info... > copy debug info to clipboard
)you can do the same with “xml tools” which is available for x86 and x64.
-
open or create a non, or not correctly indented html file
-
install xml tools 2.4.11 using plugins admin on notepad++ 7.6 and above
(or tell us if you need help on installing it on older versions) -
go to
plugins > xml tools > pretty print (xml only - with line breaks)
and your html file will be formatted correctly as seen at the screenshot below.
-
-
side note:
xml tools works even better on html than indent by fold, as it specifically does not indent <pre> preformatted tag contents, which would otherwise undesirably indent the output rendering in a browser too. -
Hi I’m trying to use XML tool as you suggested. I don’t find out the way to avoid that <br> tag is adding space as for fold.
any hint?
-
Can you get a little closer to CSS?
word-wrap -
-
a little update:
here’s an answer about
<br>
in conjunction with the xml tools auto indentation (pretty print) taken from here, in order to not leave behind a solved, but unanswered, topic. (it would otherwise hurt my eyes on a monday morning ;-) )sorry about not replying to your other thread about
<br>
yet.
i did not find any workaround using xml tools with an unclosed<br>
yet.the only way i got auto indentation to work is by using a self closing
<br/>
instead.
unfortunately many coders use<br>
instead of<br/>
since it is also valid.so until anyone finds any workaround for the xml tools auto indentation, or has a better alternative plugin, which is available for x64, you would have to replace all
<br>
with<br/>
.response from @Adriano-Ellero :
thanks I did on that way <br />
all browsers accept that!