javascript code formatter and highlighter

12,685

Solution 1

9 useful Javascript syntax highilghting scripts. There, I googled it for you. 3 of them are jQuery-based.

Solution 2

i am using codemirror.
http://codemirror.net/

its easy and cool.

Solution 3

I use Highlight.Js

Solution 4

If you want to change the syntax in a specific style or just check the style than take a look at code painter

A JavaScript beautifier that can both infer coding style and transform code to reflect that style. You can also set style preferences explicitly in a variety of ways.

Share:
12,685
Admin
Author by

Admin

Updated on June 14, 2022

Comments

  • Admin
    Admin almost 2 years

    I am looking for a jQuery plugin that can take a string of code as input and will apply formatting and Highlights to make the code easily understandable. Just like jsfiddle.net.
    As of now I have found many sites like jsbeautifier.org.. But I need a standalone jquery plugin which can process my code
    Please help me on this.

  • cmroanirgo
    cmroanirgo over 11 years
    I got lucky and end up here ;)
  • Andrej
    Andrej about 11 years
    Which of them do formatting besides highlighting?
  • Angel
    Angel about 11 years
    SHJS works great :) Thank you for this link!
  • Kees C. Bakker
    Kees C. Bakker over 10 years
    Looks cool. Haven't seen much examples though.
  • Kees C. Bakker
    Kees C. Bakker over 10 years
    CodeMirror is very extensible. Lots of projects use it: codemirror.net/doc/realworld.html
  • vanessen
    vanessen about 8 years
    this one really works well for me. I had function to remove extra tab and newlines in my pre, so the other plugin couldn't work properly because of this method. But hightlight.js work well with my function :)
  • Admin
    Admin about 8 years
    For lots of reasons the one form Google will be preferred by most: github.com/google/code-prettify
  • theEpsilon
    theEpsilon over 7 years
    it's a broken link
  • David Hedlund
    David Hedlund over 7 years
    @theEpsilon: Thanks, updated. Can't really say it's the exact same scripts, but the article is from 2010 and has the exact same title, so I guess it may well be. I get that link-only answers aren't ideal, but OP is asking for an external software, and those are bound to be links, and the question is from 2011, so some of them are bound to be broken.
  • Gurnard
    Gurnard about 5 years
    but I don't see a formatting addon. It has fantastic stuff like code completion et al but no formatting function that I can find.