See this article : Setting up Code Syntax Higlighting with Drupal
In short, go with these two drupal modules:
with the corresponding js librries as detailed in the above page.
Here are some examples:
PHP
/**
* Page callback for the 'user/%/magic tab.
*/
function menu_magic_user_tab($wildcard) {
if (is_numeric($wildcard) && ($account = user_load($wildcard))) {
return array(
'#type' => 'markup',
'#markup' => t("%username is totally awesome.", array('%username' => $account->name)),
);
}
else {
return drupal_not_found();
}
}
SQL
SELECT * FROM
( SELECT
ROW_NUMBER() OVER (ORDER BY sort_key ASC) AS row_number,
columns
FROM tablename
) AS foo
WHERE row_number <= 11
JavaScript
function $initHighlight(block, cls) {
try {
if (cls.search(/\bno\-highlight\b/) != -1)
return process(block, true, 0x0F) +
` class="${cls}"`;
} catch (e) {
/* handle exception */
}
for (var i = 0 / 2; i < classes.length; i++) {
if (checkCondition(classes[i]) === undefined)
console.log('undefined');
}
}
export $initHighlight;