Jump to content

Highlighters for the forum


The Praetorian

Recommended Posts

I was just thinking that it would be cool to add highlighters to the forum, for when we use code /code. Like CONtext and other text editors have. That way when someone is posting a code snippet, they could do this...code=php/html/css..etc /codeAnd when the code is put into the codebox, the forum automatically highlights it based on its type. I only have a vague idea of how this would be done, but I'm sure someone who knows a lot more about Invision Power Boards could figure it out. Anyway, it's just a random suggestion.

Link to comment
Share on other sites

Hmm, that's interesting. There's already the html one as you may or may not know:

<span id="attribute">Lorem ipsum...</span><!-- comment -->

Other highlighting would be cool. The question is how to do that...

Link to comment
Share on other sites

I didn't know, actually. But the html would probably work for most kinds of code anyway. The way to change it would be to make a universal thing. From my understanding of phpbb, which is probably similar to how IPB works, there's a list somewhere that tells the message board what color to make each section of code. Something like..h2 = #1092124 etcAll that would need to be done, if it isn't already done, is to add the same rules for other types of code. So that php elements, javascript elements and so on each get their own color.

Link to comment
Share on other sites

I dont think the html would work for very many codes actually. Maybe not even any..

<style type="text/css">body {background-color: black;}</style><script language="php">echo "hello world";</script><?phpecho "hello world";?><script type="text/javascript">document.write("hello world");</script>

etc... Im sure you can go on the main phpbb forums and someone has taken the time to write addons or "mods" for a few language. I know there is a php one because on programmingtalk.com thery have it. Im surew they have other ones. This would be nice for troubleshooting.

Link to comment
Share on other sites

  • 3 weeks later...
I was just thinking that it would be cool to add highlighters to the forum, for when we use code /code. Like CONtext and other text editors have. That way when someone is posting a code snippet, they could do this...code=php/html/css..etc /codeAnd when the code is put into the codebox, the forum automatically highlights it based on its type. I only have a vague idea of how this would be done, but I'm sure someone who knows a lot more about Invision Power Boards could figure it out. Anyway, it's just a random suggestion.
Instead of this, we should "select" the "link-hover" for our own option :)
Link to comment
Share on other sites

Other highlighting would be cool. The question is how to do that...
From my understanding of phpbb, which is probably similar to how IPB works, there's a list somewhere that tells the message board what color to make each section of code.
I used to use a editor called UltraEdit. It came with these wordfiles that would tell the application what the keywords, attributes, comments, etc. were for a specific language and then highlight them accordingly depending on what language you had selected for the syntax highlighting.Here's an example of one of the wordfiles that I just found:http://sclogic.vo.llnwd.net/o2/downloads/wordfile.txt
Link to comment
Share on other sites

I am a Mod at another Forum that uses IPB and we have an "sql" bbcode and a "highlight=color" bbcode.

if(isset $_GET['id'])){$id = $_GET['id'];// --------- here code to connect to mysql and select database -----------$query= mysql_query("delete FROM comment where id =$id")or die(mysql_error());}

[highlight=yellow] test this forum [/highlight]*edit* I guess the highlight code is maybe something added over there by the Admins. Doesn't seem to work here.A Tutorial can be found at the trap17 Forum.The conText editor also display files using the file extension as a guide to the colour coding. Wonder how that is done???

Link to comment
Share on other sites

I am a Mod at another Forum that uses IPB and we have an "sql" bbcode and a "highlight=color" bbcode.
if(isset $_GET['id'])){$id = $_GET['id'];// --------- here code to connect to mysql and select database -----------$query= mysql_query("delete FROM comment where id =$id")or die(mysql_error());}

[highlight=yellow] test this forum [/highlight]*edit* I guess the highlight code is maybe something added over there by the Admins. Doesn't seem to work here.A Tutorial can be found at the trap17 Forum.The conText editor also display files using the file extension as a guide to the colour coding. Wonder how that is done???

Yea, IPB does have the custom bbcode options. But how would you code syntax highlighting for over 20 languages? Does anyone have the time to do so? :)
Link to comment
Share on other sites

The highlight tag as defined in that link creates a background colour similar to using a 'Highlighter' on a textbook or a page of notes from a school lecture. It simply changes the background colour for a block of text. Not the foreground colour as per Jonas' posting.It is actually quite useful for indicating changes to code snippets.

Link to comment
Share on other sites

The conText editor also display files using the file extension as a guide to the colour coding. Wonder how that is done???
File types can be defined in the highlighter itself for ConTEXT, or also by going to Tools -> Set Highlighter -> Customize Types. You can specify which highlighter gets applied for which extensions.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...