The code tag now looks like:
<code name="filename" start="1">
</code>
where both parameters are optional. The name attribute is meant to be the name or title of the source code. The start attribute is the first line number. If omitted, it is assumed to be 1.
Short code snippets with no name and starting line number will be inline without any chrome.
Lines can be highlighted by appending *** to them.
To turn off line numbers (copy / paste) click the # button. Click the 'E' to get rid of the scrollbars.
When making this post, I realized that there is a slight problem with multiline coloring (e.g., comments) that disables highlight ability and the original colors. That will be fixed later.
Refresh JS/CSS files.
Cool! I was gonna say it was ugly but then I refreshed the js/css. Very pretty.
The error is on line 127.
It takes a long time (two seconds roughly) to turn the line numbers off in IE7. Turning them back on is significantly faster.
A nice set of additions.
EDIT: Dustin's post removes the line #s fast.
Hiding and showing line numbers fast enough on Matthew's example breaks the scroll bar (Firefox 3.0.7).
Other than that, this is pretty sweet!
Cool stuff.
When I disable line numbers, the font size changes from 10 to 8. Using Firefox 3.1b3 on Windows.
Very nice! I really like all the new work you've put into the site lately Matthew!
This is by far the best forum system I've used!
Hiding and showing line numbers fast enough on Matthew's example breaks the scroll bar
Same here
Now add support for multiple languages.
Very nice! Now it looks like a programming forum! Could you add some way of selecting all code instead of having to scroll around? That is the only thing I would want.
The only problem I find is that when scrolling with the well the page upwards or downwards, the top of the code box somehow jumps above the navigation bar of the site, so you get some strange effect.
Here's what it looks like in konqueror (4.3 svn), I'm sure you can see a couple flaws.
{"name":"accnewcodeboxkonqi.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/d\/2d9e97fe0d1c247dffc4b31cadee19bd.png","w":814,"h":425,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/d\/2d9e97fe0d1c247dffc4b31cadee19bd"}
Use a better browser.
edit:nm
edit2:
it was happening briefly with WebKit too, but now its not happening in either WebKit or KHTML.
I find it really odd that everything there's an update, my cache seems to have been cleared out enough that I don't need to hit Ctrl+F5...
The collapse/expand feature could stand to be a little more obvious. I don't think newbies would catch on without prompting.
It takes a long time (two seconds roughly) to turn the line numbers off in IE7. Turning them back on is significantly faster.
IE is a horrible web browser. If you have any choice, you shouldn't use it. Let's take a look at the benchmark of the said operation:
Safari 4: 14 ms
Opera 9.64: 50 ms
FireFox 3: 61 ms
IE 8: 817 ms
This is just a typical string build during a DOM traversal.
Safari is so fast you don't even realize anything has happened. Opera and Firefox are both nearly as fast—neither of them feel lagged. Then IE 8, Microsoft's latest and greatest browser, steps up to the plate and takes nearly a second.
But keep using IE.
Hmm... I would like the top (filename, numbering on/off) to be at the bottom too if you expand the code and scrolled to the bottom. Also, although I am not sure if it is possible at all, can I generate a URL to point to the line 104 of the code you posted at the top?
Fixed some bugs.
No way to do inline code snippets yet?
Thanks for fixing the font size, but any chance of courier new 10 instead of 8? Maybe I'm just old, but reading text that small is not a joy.
You can use custom CSS to change things like that.
div.source-code div.inner td, div.source-code div.inner pre { font-size: 10pt !important; }
Cool, thanks.
Neat, now it looks precious.
precious
Looks at your avatar
My precioussss....
No way to do inline code snippets yet?
Just <code> with no new lines. e.g., while (false) create_bitmap(640, 480)
test: int test(char bar);***
seems not to work
int test(char bar);
works...
Just <code> with no new lines. e.g., while (false) create_bitmap(640, 480)
Hmm. I could've sworn it didn't work when I tried it the first time.
Hmm... I don't see the point in having inline code highlighted...
I mean, Thomas wanted to highlight a single inline line.
Yeah, that would be a great way to annoy the crap out of people
Well the ***s are just highlighted as operators.. Maybe they should be removed if they are there?
Hmm... I don't see the point in having inline code highlighted...
For the same reason we highlight other code... To make it easier to read and/or catch mistakes.
Highlighting inline code is obnoxious and not supported. Removing the highlight characters would give the false impression that it is.
I just noticed that in the thread review when replying to a post the code boxes have large spaces in between lines.
Other than that I'm quite pleased with the update .