JavaScript Syntax Highlighter can be used for client-side syntax highlighting of following languages: HTML, CSS, JavaScript, PHP, SQL, HTTP and SMTP protocol, php.ini
and Apache config.
JUSH is available also as jQuery and WordPress plugin .
__halt_compiler
, heredoc, backticks, {$}
variables inside strings, namespaces<table cellspacing="0" cellpadding="2" onclick="alert(this.rows.length);">
<?php
$result = mysql_query("SELECT * FROM tab");
while ($row = mysql_fetch_assoc($result)) {
?>
<tr>
<th><?php echo htmlspecialchars($row["title"]); ?></th>
<td style="text-align: right;"><?php echo $row["price"]; ?></td>
</tr>
<?php } ?>
</table>
</body>
tag in HTML file:
<script type="text/javascript" src="jush.js"></script>
<script type="text/javascript">
jush.style('jush.css');
jush.highlight_tag('code');
</script>
All <code class="jush">
tags will be highlighted. Language is determined by the class name beginning with "jush-" (e.g. <code class="jush-js">
). Default language is htm
. It is also possible to use <code class="language-*">
.
Alternativelly call jush.highlight(language, text)
to syntax highlight single text.