Online code beautifier and formatter [closed]
Asked Answered
W

8

91

What are the best online code beautifier and formatter out there? I'm not asking for highlighters. Any language will do.

Whereas answered 15/10, 2008 at 20:54 Comment(3)
viewed over 57k times... good thing you guys got on top of it and closed thisSporocyte
Over 61k times now, so about 4k views in the last month. Yes, definitely not a constructive question.Adiaphorism
Not sure why this topic was closed, but tohtml.com/javaProperties worked well for me. The styles and color are "inline" which makes it very simple to copy and paste into something else.Aconcagua
P
108

CSS: code beautifier

HTML: HTML Tidy, CleanUp HTML or the general purpose Pretty Diff

Javascript: http://jsbeautifier.org/

PHP: http://beta.phpformatter.com/

SQL: http://dpriver.com/pp/sqlformat.htm

XML: http://chris.photobooks.com/xml/default.htm

Colour all: http://quickhighlighter.com/

Posology answered 15/10, 2008 at 20:54 Comment(6)
Can you suggest any formatter which follow PSR-2 code standard for PHP?Illeetvilaine
For SQL formatting there is the free online Formatter SQLinForm sqlinform.com/sql_formatter_online.htmlLvov
I dont find anything for AWK. SurprisedCortes
or use pastebin and highlight code for a variety of languages - pastebin.comRondi
For VB indentation: warp.senecac.on.ca/timothy.mckenna/CodeFormatter.aspFetial
has anyone a Code Beautifier (not a highlighter) for PHP7?Carpophagous
G
25

For PHP, Java, C++, C, Perl, JavaScript, CSS you can try:

http://www.prettyprinter.de/index.php

Garrick answered 15/10, 2008 at 20:54 Comment(3)
Did you actually try this one? It outputs > for > and similar.Onslaught
I think that is because those will be embedded inside another html page, as a sample, etc, and really should be.Lemmie
It outputs < for &lt;...Croupier
F
11

You can use Perl::Tidy for Perl.

Forbes answered 15/10, 2008 at 20:54 Comment(0)
S
9

JsonLint is good for validating and formatting JSON.

Sinner answered 15/10, 2008 at 20:54 Comment(2)
JsonLint is a great tool for quickly validating JSON output.Strasbourg
If you're using Chrome, there's a great json formatter extension at chrome.google.com/webstore/detail/…Gerda
B
5

It depends of the language, and of the architecture you are using.

alt text alt text

For example, in a php platform, you can format almost language with GeSHi

As bluish comments, GeSHi is a generic syntax highlighter, with no beautification feature. It is more used on the server side, and combine it with a beautification tool can be tricky, as illustrated with this GeSHi drupal ticket.

Babiche answered 15/10, 2008 at 20:54 Comment(3)
-1 has no beaufitication, only hightlightingPosology
@bluish: true. I have included your comment in my answer.Babiche
@Glorfindel Thank you for the edit. I thought I lost those images for good.Babiche
S
5

What language?? There are different tools for almost every imaginable programming language, since they all have different syntactic rules and conventions.

Good ol' indent is a nice, customizable, command-line utility to format C and C++ programs.

Schermerhorn answered 15/10, 2008 at 20:54 Comment(1)
Since the question asked for "online beautifier", do you know of any Web frontends to indent?Encomium
N
2

I've used Quick Highlighter a lot. Works great for a huge list of languages.

Nada answered 15/10, 2008 at 20:54 Comment(1)
-1 OP didn't ask about highlighters. This doesn't do formatting/beautifying.Posology
L
1

Use gist.github.com. There is a multi-language support(java, c, c++, c#, vb, haskell, ruby, javascript, lua, HTML, SQL, Tcl, Perl, JSON, groovy...)

Here is a sample "Generate LiquiBase changeLogs using Groovy"

Lid answered 15/10, 2008 at 20:54 Comment(5)
Dude, it's really beautiful. I'd choose this as the answer :-) Thanks…Anthropomorphous
its only showing pasted code. How to format that ?Santinasantini
that is correct, it is a code beautifier and code snippets storage. It has some cool features (like share, star and private snippets).Lid
checked most of links on this page. This one is best.Morty
-1, This is a code highlighter not a code beautifier / formatter.Juliojulis

© 2022 - 2024 — McMap. All rights reserved.