Jump to content
xisto Community
sonesay

Syntax Highlighting For Code

Recommended Posts

Hey all, I'm not sure if its been brought up but I couldn't find any topics on this. Has anyone brought up the idea of updating the blocks to allow syntax highlighting? This would be a nice feature to have but I don't know if its something that can be easily added on. I don't know about you guys but when I see long blocks of code in the same color from users I just don't want to read them. Especially when they are put in a small box container about 100px high and I have to scroll through it. Making code easier to read would help a lot.

Peace
Sone.

Share this post


Link to post
Share on other sites

There is an HTML and an SQL BBcode tag already on the system.

<h2>Tab Menu 1</h2><div id="menu1">		<ul>		<li><a href="#1" title="Link 1">Link 1</a></li>		<li><a href="#2" title="Link 2">Link 2</a></li>	     		<li><a href="#3" title="Link 3">Link 3</a></li>			<li><a href="#4" title="Link 4">Link 4</a></li>			<li><a href="#5" title="Link 5">Link 5</a></li>			</ul></div><br />

// This file contains the database access information. // This file also establishes a connection to MySQL and selects the database.// This file also defines the escape_data() function.// Set the database access information as constants.DEFINE ('DB_USER', 'username');DEFINE ('DB_PASSWORD', 'password');DEFINE ('DB_HOST', 'localhost');DEFINE ('DB_NAME', 'sitename');// Make the connection.$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );// Select the database.@mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error() );

Share this post


Link to post
Share on other sites

Oh thanks for that information I didn't know they existed. That's good having syntax highlighting for that but I was hoping we could get them for some other languagues like PHP, Java, Javascript, C, C++ and what ever else is out there.

Share this post


Link to post
Share on other sites

Well syntax highlighting for php should be fairly easy seeing as php has a built in function to do it for you. highlight_string(). An admin would just have to add a new bbcode tag that ran all inclosing text through that function.

Not only that, but there are really nice plugins for almost every board type which can highlight *many* languages. It'd be a really nice function, I guess. I bet the folks back at the coding sections would love it ;)

Even though it is Python-based, there's a cool highlighter called Pygments... It works pretty fine (even though there are bugs, of course).

Share this post


Link to post
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...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.