-
Total Universe Mod
It's time to talk about code highlighting
Last year sometime I requested a "wrap [code] tags" button in the quick reply which after some resistance was kindly added. I'm glad it happened because I've used it a great deal ever since.
The purpose of this thread to discuss (not request) a few finer point along that topic. The reason I say discuss is because I know I'm about to open a sore can worms and understand that somethings simply have good reasons for their existence or lack of it.
What we have available are [code] and [php] tags for wrapping code samples. Both have their benefits and drawbacks. The php tag, while being a little misleading as a heading to its relative code sample (more on that in a sec), has wonderfully colorized syntax but has certain limitations when there is a desire to combine it with other text tags like [bold] or [italic].
Sometimes while answering a code question, I prefer to put the code I fixed in bold so as to better inform the person what changed.
The Code tag on the other hand, allows for this mixed styling but alas lacks colorized syntax.
My purpose is not so much to suggest making either of those accommodate the other as it is to hearken back to a day when we had [as] as an option. If I remember correctly it provided both solutions.
I think its safe to say flashkit isn't going anywhere and that the [as] tag is sorely missed. My goal here is to understand why it no longer exists and what we as a community might do to get it back.
Thank you.
As an aside, the static width of a code block (640px) doesn't seem all that appropriate. I don't see why it cant run the width of the post. Just sayin'
PHP Code:
Some [B]bold[/B] code
Last edited by jAQUAN; 12-18-2009 at 03:21 PM.
-
the initial reason was because the code highlighter we were using was written for an ancient version of the software, however I will check into more modern options.
-
Senior Member
-
We have found and installed a multilanguage syntax highlighter, and are currently testing it before we roll it out to the forum at large.
-
Senior Member
This is awesome news. Thank you JP!
-
if any of you want to test it out, the tag is named highlight, and you must add = Actionscript inside the opening tag, at least if you're using long reply. For quick reply I added a regex replace which will add it for you if you had no language parameter at all
-
Total Universe Mod
testing...
Actionscript Code:
package com.flashkit.highlighting{ import flash.events.*; import flash.text.TextField; public class HighlightTest extends TextField{ public function HighlightTest(){ addEventListener(Event.ADDED_TO_STAGE, onAdded); }
private function onAdded(e:Event):void{ removeEventListener(Event.ADDED_TO_STAGE, onAdded); init(); } //part of this comment is [B]bold[/B] private function init():void{ [B]text = "Hellooooo highlighting!";[/B] } } }
dang, still no inline font adjustments but hey, its a start! Thank you for your efforts JPnyc!
Last edited by jAQUAN; 02-04-2010 at 04:59 PM.
-
OK, the little AS button will now wrap highlight tags around code. It will work for other languages besides action script, so you do have to specify = actionscript inside the opening Tag
-
Total Universe Mod
Thanks again JPnyc. FK just got a little better. I still wish bold and italic tags were working within the block but I'm sure it took some doing just to implement the highlighter as is.
-
I disabled other BB code within these tags intentionally. It's a very simple matter to enable it again if everybody wants that.
-
Total Universe Mod
Yeah I guess if there's a potential risk of mangling code that uses array items or object evaluation it's better to turn it off. Otherwise, bolding makes it easy for the newbs to understand what changed.
-
Well whatever the majority wants is fine by me. Not a difficult change to make at all. Takes 2 seconds.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|