• Login
Community
  • Login

auto-ident function in html page

Scheduled Pinned Locked Moved General Discussion
identauto-identautoidenthtml
10 Posts 4 Posters 13.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    Adriano Ellero
    last edited by Feb 9, 2019, 5:36 PM

    Hi all, the auto-ident function does not work on my simple html page.
    Any hint?

    A M 3 Replies Last reply Feb 9, 2019, 6:22 PM Reply Quote 0
    • A
      Alan Kilborn @Adriano Ellero
      last edited by Feb 9, 2019, 6:22 PM

      @Adriano-Ellero

      Answers here: https://notepad-plus-plus.org/community/topic/15958/faq-desk-you-ve-asked-your-question-in-the-wrong-place

      1 Reply Last reply Reply Quote 0
      • M
        Meta Chuh moderator @Adriano Ellero
        last edited by Feb 9, 2019, 8:01 PM

        @Adriano-Ellero

        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:

        Imgur

        • now go to the menu plugins > indent by fold > reindent file, and your code will be correctly indented

        Imgur

        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. 👍

        @Alan-Kilborn

        this time i don’t agree with you … (yeeeeyh 😄 )

        1. this question was correctly posted at general discussion.
          (i will overlook his double posting at “help wanted”)

        2. this is a direct question to the notepad++ built in auto-indent feature, which does autoindent for eg. c++ and php functions.

        3. @Adriano-Ellero was very polite, understanding and responsive so far, even after having been served by our man of few words 😉

        1 Reply Last reply Reply Quote 2
        • A
          Adriano Ellero
          last edited by Feb 9, 2019, 8:32 PM

          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.

          M 1 Reply Last reply Feb 9, 2019, 8:49 PM Reply Quote 1
          • M
            Meta Chuh moderator @Adriano Ellero
            last edited by Meta Chuh Feb 9, 2019, 8:56 PM Feb 9, 2019, 8:49 PM

            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.

            Imgur

            1 Reply Last reply Reply Quote 2
            • M
              Meta Chuh moderator @Adriano Ellero
              last edited by Feb 9, 2019, 8:59 PM

              @Adriano-Ellero

              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.

              1 Reply Last reply Reply Quote 1
              • A
                Adriano Ellero
                last edited by Mar 9, 2019, 11:22 AM

                @Meta-Chuh

                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?

                A 1 Reply Last reply Mar 9, 2019, 11:37 AM Reply Quote 0
                • A
                  andrecool-68
                  last edited by Mar 9, 2019, 11:34 AM

                  Can you get a little closer to CSS?
                  word-wrap

                  1 Reply Last reply Reply Quote 0
                  • A
                    andrecool-68 @Adriano Ellero
                    last edited by Mar 9, 2019, 11:37 AM

                    @Adriano-Ellero
                    https://www.w3schools.com/css/

                    M 1 Reply Last reply Mar 11, 2019, 9:31 AM Reply Quote 0
                    • M
                      Meta Chuh moderator @andrecool-68
                      last edited by Meta Chuh Mar 11, 2019, 9:33 AM Mar 11, 2019, 9:31 AM

                      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!

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors