2

Somebody sent me something like this code snippet below (i honestly don't know where he learnt coding from)

<div class="fl spinner2" style="position: absolute; left: 611.5px; top: 302.5px;"><div class="spinner-container container1"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div><div class="spinner-container container2"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div><div class="spinner-container container3"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div></div>

Is there a plugin for Notepad++ that can help me auto-format and indent it appropriately. It will take too long for me format it by hand.

I need it to look like this

<div class="fl spinner2" style="position: absolute; left: 611.5px; top: 302.5px;">
<div class="spinner-container container1">
    <div class="circle1"></div>
    <div class="circle2"></div>
    <div class="circle3"></div>
    <div class="circle4"></div>
</div>
<div class="spinner-container container2">
    <div class="circle1"></div>
    <div class="circle2"></div>
    <div class="circle3"></div>
    <div class="circle4"></div>
</div>
<div class="spinner-container container3">
    <div class="circle1"></div>
    <div class="circle2"></div>
    <div class="circle3"></div>
    <div class="circle4"></div>
</div>

  • Errm, shouldn't the second line (<div class="spinner-container container1">) and subsequent lines be indented, because you have not yet closed the dive from the first line? – Mawg says reinstate Monica May 10 '17 at 11:48
  • And, I know that it's not your code, but it's best to use CSS, rather than in-line styling – Mawg says reinstate Monica May 10 '17 at 11:49
  • 1
    that why i had to comment on his coding skills. – tobiElyon May 11 '17 at 17:09
1

You can use the "Tidy 2" plugin or the "XML Tools" which both are available in the "plugin manager".

Source: https://stackoverflow.com/questions/7117949/how-to-auto-format-indent-xml-html-in-notepad

| improve this answer | |
  • Thanks. This saved me so much time. – tobiElyon May 11 '17 at 17:07
  • It only works on 32bit OS. 64 Bit it fails. – D-AppMuncher Feb 27 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.