Welcome to WebmasterWorld Guest from 54.197.116.116

Forum Moderators: brett tabke

Message Too Old, No Replies

Better Code view

syntax highlighting

   
7:38 pm on May 25, 2010 (gmt 0)

5+ Year Member



Be nice to have a better code view. There are several opensource mods to do this. I've got one installed on my wordpress blog, and I love it.

I like the syntax highlighting and line numbering. It makes the code more readable, can immediately show syntactical errors, and it's easier to say to a poster things like "line 3 should be...". Many also have a nifty javascripting goodies to do things like turn on/off line numbering or copy code.
7:44 pm on May 25, 2010 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



yes yes yes yes yes!
7:50 pm on May 25, 2010 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Great suggestion!
8:59 pm on May 25, 2010 (gmt 0)

5+ Year Member



Personally I like GeSHi: [qbnz.com ]

But Alex Gorbatchev SyntaxHighlighter is also really nice: [alexgorbatchev.com ]

Both are fairly easy to implement.
9:20 pm on May 25, 2010 (gmt 0)

5+ Year Member



Yes, this would be great!
9:29 pm on May 25, 2010 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



We have the perl Kate syntax highlighter system already embedded. We have only to announce it.

example
[webmasterworld.com...]

cpan
[search.cpan.org...]
9:41 pm on May 25, 2010 (gmt 0)

5+ Year Member



Excellent! Looks like it can do most languages to boot...
10:48 pm on May 25, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Code is always problematic - especially as the "code" tag only gets the first line in a code block, and that leaves quotes as about the next best option.

Not sure if I would like automated code highlight - css / html forums often get lots of massive code dumps, and automated highlighting may possibly exacerbate the visual "clutter".

I like the suggestion of line-numbering. Better implementation of the code tag would be great. The ability to manually colour lines/comments was a great tool, but I noticed it wasn't available when I tried to use it a few days ago.
12:40 am on May 26, 2010 (gmt 0)

5+ Year Member



well, thats good. It is really good to have that one, too emphasize codes with errors, and easy to point out what is the problem of the code.
1:53 am on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Resounding YES!

Personally, I would help out more often if I could make sense of what people are trying to achieve. Syntax highlighting (and preformatting?) would help a lot in that respect.
1:01 pm on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Yes, this would be very helpful.
2:44 pm on May 26, 2010 (gmt 0)

10+ Year Member



that would be one of the biggest improvements to this forum.
5:17 pm on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I absolutely love how the Sitepoint forums handle syntax highlighting:

Numbered lines
Code in a scrolling <div> of a consistent height/width
VERY nice and clear coloring
Proper handling of tabs and spaces.
5:36 pm on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It would also be nice to be able to keep track of the indentation of code!
6:41 pm on May 26, 2010 (gmt 0)

10+ Year Member



I can't agree with andrewsmd more. Syntax highlighting is nice, but to me, code indentation is a must.
6:45 pm on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We have the perl Kate syntax highlighter system already embedded. We have only to announce it.


Works for me
9:24 pm on May 26, 2010 (gmt 0)

5+ Year Member



css / html forums often get lots of massive code dumps

True

As per 'syntax highlighting', folding would be nice :)

Here's another vote for indentation
9:33 pm on May 26, 2010 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The syntax highlight will have a line limit. We are not going to become a code dump forum...
9:40 pm on May 26, 2010 (gmt 0)

5+ Year Member



We have the perl Kate syntax highlighter system already embedded. We have only to announce it.
Works for me

Not me...

:(

What am I missing?
9:47 pm on May 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



AndrewsMD,


It would also be nice to be able to keep track of the indentation of code!


Definitely, lots of times I have been caught out using the tab, then realising I have stopped entering text!

perl Kate syntax highlighter system already embedded.

Well if it is, I cant see it?! - I'll keep looking...

Cheers,
MRb
1:30 am on May 27, 2010 (gmt 0)

5+ Year Member



@Brett_Tabke, please ensure that the line limit isn't too restrictive as someone may be helping by publishing a batch of code to solve a problem and having it on the post will make it easier for someone else to come and use that same batch of code at a later date.

This feature would be a huge plus for the site!
7:42 pm on Jun 2, 2010 (gmt 0)

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The [ code ] BBcode should be visually separated from regular text as the [ quote ] BBcode is preferably with a slightly shaded background color and a border.

Syntax highlighting is okay though I'd really appreciate it if my indenting was retained. Granted this is a double edged sword as I indent only one space keeping my code readable while people indent using tabs and multiple tabs at that! So I think replacing tabs with a single space would greatly reduce the clutter.

function 1()
{
if (2)
{
if (3)
{

}
}
}

I format function brackets to not be spaced however the first nested brackets I use a single space, the second two, third three, etc.

- John