99

I have some JavaScript code that is written in one line (no carriage returns), it's completely unreadable...

With Notepad++, I tried to replace these characters ({, }, ;) by themselves plus a carriage return, but it still isn't very handy...

Is there a way to do this correctly in Notepad++?

1
  • I've edited the question to focus on how to do this in NP++, rather than to ask for a software recommendation. And voted to reopen. Commented May 10, 2019 at 13:27

5 Answers 5

212

JSTool is the best for stability.

Steps:

  1. Select menu Plugins>Plugin Manager>Show Plugin Manager
  2. Check to JSTool checkbox > Install > Restart Notepad++
  3. Open js file > Plugins > JSTool > JSFormat
    screenshot

Reference:

Sign up to request clarification or add additional context in comments.

4 Comments

Just tried this today. It worked perfectly. Nice simple explanation, thanks.
Awesome.. Its working. you can use it offline also. Bye bye JS beautifier
+10 , I used to do with online beautifier but this one is just perfect!
Nice. My only gripe is that it appears at the top of the list of Plugins, which I believe is sorted alphabetically by file name of all things. Certainly a much smaller inconvenience than manually formatting source code or copying and pasting into a web page, though!
65

I think you want a code beautifier, this one looks quick and easy: http://jsbeautifier.org/

Comments

51

Try the notepad++ plugin JSMinNpp(Changed name to JSTool since 1.15)

http://www.sunjw.us/jsminnpp/

Comments

7

Use jsbeautifier instead of trying to do it manually.

Comments

7

Could you use online services like this ?

Update: (as per request)

Google chrome will do this also http://cristian-radulescu.ro/article/pretty-print-javascript-with-google-chrome.html

3 Comments

Arh, beaten too it. Sorry. Google chrome will do this also cristian-radulescu.ro/article/…
Didn't know that trick on chrome, is is useful too, thank you
@SamGreenhalgh I'd love to see your comment pulled into your answer. It's applies to any webkit browser, and there's no need for an external service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.