Click to See Complete Forum and Search --> : Display code with syntax highlight
Hello,
on some site there are code examples on the html page with syntax highlighting. How can I make such output? Is it CSS or HTML relevant or some 3rd party tool generated the site maybe?
Thanks!
WebJoel
06-22-2006, 11:56 AM
Hello,
on some site there are code examples on the html page with syntax highlighting. How can I make such output? Is it CSS or HTML relevant or some 3rd party tool generated the site maybe?
Thanks!
When you post code hereon, there is a menu bar at the top, right above the text area. There are 'insert hyperlink', 'insert e-mail link', 'wrap [CODE] tags around selected text', 'wrap [HTML] tags around selected text' (etc.) buttons. You should use them when posting code. This not only allows proper parsing of code elements (give color-coding to certain reserved and meaningful context), but (in therory) prevent malicious code from 'running' although seriously I doubt if posting any snippette of code directly into the text area here would launch a malicious payload...
Notice how your question is "quoted"? That dark gray quote-box is another example of how this works.
-Joel
Hello,
the format below is exactly what I want (and what you say :) ). What I don't know how can I have such an output on my private html site which only have some words on it and this code?
<?php
require_once('mysql.php');
$serverhost = "localhost";
$serveruser = "test";
$serverpwd = "test";
// Connection to database: hosting
$dbname_hosting = "test";
$MyDb = new cMysqlDB($serverhost,$serveruser,$serverpwd,$dbname_hosting);
?>
WebJoel
06-22-2006, 04:16 PM
Hello,
the format below is exactly what I want (and what you say :) ). What I don't know how can I have such an output on my private html site which only have some words on it and this code?
<?php
require_once('mysql.php');
$serverhost = "localhost";
$serveruser = "test";
$serverpwd = "test";
// Connection to database: hosting
$dbname_hosting = "test";
$MyDb = new cMysqlDB($serverhost,$serveruser,$serverpwd,$dbname_hosting);
?>
Then you need to get an HTML-editor like EDITPLUS2.exe or HTML-kit. That way you can have 'color-coded syntaxia' at-home. :)
Albert_chu
06-23-2006, 12:01 AM
i used to have a program called bluejay that used to highlight syntax errors in my coding.
ray326
06-25-2006, 11:53 PM
I believe the desire is to generate syntax highlighted HTML representing the parsed code similar to the way the HTML and PHP blocks in this forum work. There is a very nice cross platform programmer's editor called jEdit that has a plugin Code2HTML that performs that function. I use it on Windows and I just installed it on ubuntu Linux and it works like a champ. You have to have a JRE installed because it's a Java app.
http://jedit.org