collapse everything except <h1>

  • i’m writing a very long text in html.after a while it is difficult to find a part i’d like to edit. it would be nice to collapse all text except h1 titles. is there any way to do this?

  • Hello, @paweł-łabno and All,

    Not totally sure that is the right solution for you ! But let’s give it a try ;-)). I simply suppose that all your titles lay in a single line. So :

    • Open one of your html files, in N++

    • Fold all the sections with the View > Fold All menu option or use the Alt + 0 shortcut ( NOT from the numeric keypad ! )

    => The text collapses and you should see the <html> tag, only !

    • Then, open the Find dialog Search > Find… menu option or use the Ctrl + F shortcut

    • Type in the regex (?-is)(?<=<h1>).*?(?=</h1>) , in the Find what: zone

    • Select the Regular expression search mode

    • Click on the Find All in Current Document button

    => At once, the Find result windows pops up, at bottom of the screen, with all the <h1>....</h1> titles !

    • Now, simply double-click, in the Find result window, on one of these results. Immediately :

      • Your HTML file should expand the zone, containing the corresponding <h1>....</h1> title ;-))

      • All the title, between the boundaries <h1> and </h1>, is selected

    Best Regards


Log in to reply