I am trying to use prism.js to highlight some PHP code examples, but it's not working. Code:
<pre class="language-php">
<code class="language-php">
$var = abs(-4.2);
var_dump($var);
// float(4.2)
</code>
</pre>
How it looks in browser:
The prism css and js files are linked to the page. How do I get this PHP code colorized?
Prism.js can highlight the syntax of about 100 languages. To keep the JavaScript and CSS files as small as possible, you specify which language(s) you want/opt in on it's web site (https://prismjs.com/download.html) and build your custom files. I did not add PHP (it has JavaScript by default) initially, and when I re-made my prism files with PHP, it worked.