Welcome to WebmasterWorld Guest from 54.196.243.192

Forum Moderators: brett tabke

Message Too Old, No Replies

Better Code view

syntax highlighting

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

New User

10+ Year Member

joined:June 21, 2005
posts: 26
votes: 0


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)

Moderator from CA 

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

joined:Aug 29, 2003
posts:4059
votes: 0


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

Senior Member from US 

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

joined:Oct 17, 2005
posts:4966
votes: 10


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

New User

10+ Year Member

joined:June 21, 2005
posts:26
votes: 0


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)

New User

10+ Year Member

joined:July 21, 2005
posts:30
votes: 0


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

Administrator from US 

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

joined:Sept 21, 1999
posts:38048
votes: 12


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)

New User

10+ Year Member

joined:June 21, 2005
posts:26
votes: 0


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

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Aug 9, 2008
posts: 961
votes: 0


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)

New User

5+ Year Member

joined:Apr 8, 2010
posts:3
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 16, 2007
posts:846
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


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

Junior Member

10+ Year Member

joined:Mar 5, 2004
posts:198
votes: 0


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 9, 2003
posts:1908
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:June 10, 2008
posts: 1130
votes: 0


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)

Full Member

10+ Year Member

joined:Feb 4, 2004
posts:215
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 27, 2002
posts:1187
votes: 0


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)

Preferred Member

5+ Year Member

joined:May 29, 2007
posts:578
votes: 0


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)

Administrator from US 

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

joined:Sept 21, 1999
posts:38048
votes: 12


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)

Preferred Member

5+ Year Member

joined:May 29, 2007
posts: 578
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 22, 2009
posts:1396
votes: 0


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)

Junior Member

5+ Year Member

joined:Apr 17, 2009
posts:107
votes: 0


@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 June 2, 2010 (gmt 0)

Senior Member from US 

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

joined:Aug 26, 2004
posts:3145
votes: 12


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