Reputation: 227
I'm using highlight.js to highlight the following code:
<pre><code class="hljs php">
echo '<table border="1">';
echo '<tr>';
foreach ($keys as &$k)
{
echo '<th>'.$k.'</th>';
}
echo '</tr>';
echo '</table>'
</code></pre>
AAAnd all the table tags are rendered by the browser and not displayed as clear text... see for yourself(jsfiddle without highlight.js)
Is it me oris there something wrong with the code tags? Any Ideas? Thank you
Upvotes: 0
Views: 504
Reputation: 871
Your tags:
<pre><code bla bla> must end </pre></code>
Final
<pre><code bla bla> must end </code></pre>
EDIT: Answer in the comments:
<pre>
<code class="hljs php">
<table>
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
</tr>
</table>
</code>
</pre>
Its nessecsary to HTML Escape the '<' and the '>'. This can be achieved with this php Function
Upvotes: 2