Prettifying code to give it the same colourization as SSMS

How can you prettify SQL code correctly with this site?

I'm a great fan of color-coding SQL so that it looks just like it does in SSMS. I've pored through the various help texts, but it looks to me as it is not possible with this site or in Stack Overflow. If someone can come up with an answer it would be great. I'll certainly alter the Prettifier to do it.

more ▼

asked Oct 11, 2009 at 07:57 PM in Default

avatar image

Phil Factor
4.2k 8 26 21

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

I believe that we've managed to get the code formatting on the main SSC site working reasonably well now (albeit with maybe one or two issues still outstanding). We have a fair amount of control over this site though, so we ought to be able to substitute the javascript that causes the code to be highlighted with the one we've been using fairly successfully, including the CSS that will style it more like management studio.

more ▼

answered Oct 12, 2009 at 03:46 AM

avatar image

Melvyn Harbour 1 ♦♦
1.4k 19 40 26

Right. Now we have a new site with the friendly and competent people at OSQA to help, what about getting the colorizing stuff out of SSC into ASK?

Jun 29, 2010 at 02:21 PM Phil Factor
(comments are locked)
10|1200 characters needed characters left


The SO code allows very limited formatting control, in large part because it already highlights & colorizes code blocks, like so:

    protected char LA(int count)
        if (_pos + count >= _data.Length)
            return _EOF;
            return _data[_pos + count];

However, as you know by now, it only works right on C-style syntax (C, C++, C#, Java, etc.), because of the persuasive belief by many who code exclusively in these languages that this list "covers just about everything".

Frankly, and IMHO, this is a problem with the software product being used here, and Redgate and the other SQL sites using it should take this back to them and tell them to make it work correctly for SQL code.

more ▼

answered Oct 11, 2009 at 09:57 PM

avatar image

782 6 9 12

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Oct 11, 2009 at 07:57 PM

Seen: 2626 times

Last Updated: Feb 17, 2010 at 07:27 AM

Copyright 2018 Redgate Software. Privacy Policy