HTML Auto-indent



  • Hi,

    I’d like to set Auto-indentation for HTML coding. That would mean that as I’m typing the text is formatted:

    <!DOCTYPE html>

    <html>

    <head>
    	<title>A web</title>
    </head>
    
    <body>
    	<p>View</p>
    	<p>Another View</p>
    	
    </body>
    

    Rather than
    <html>
    <head>
    <title>A web</title>
    </head>

    I have auto-indent selected under MISC but doesn’t seem to do anything of this and by using Plug-in Tidy2 you get that, but it adds some code too. Is there any way to get that automatically?
    Thanks in advance



  • Hello @Chema-Ramos,

    npp’s auto-ident does ident to current level, which means you do the first indent
    and npp keeps doing it for the nex lines but only at this level.

    In regards to your wish having this automatically indented for all levels,
    there is also an UniversalGuiIndent plugin - but I don’t have any information
    about it, never used it.

    Regarding tidy2, you know that you can configure the settings to your needs, don’t you?
    Check Show Config Help to get the information what can be done.

    Cheers
    Claudia



  • Thanks Claudia,

    I knew about tidy2 config but even I can edit that, it still adds several things I don’t wish.
    Anyway thank you because the explanation about you can indent first lines and then npp keeps doing it.

    Also playing with it, I’ve found very useful XML Tools plug-in, with Pretty print (text indent) function leaves the code very nice.

    Thank you very much Claudia!!


Log in to reply