Plugin: Trim Code
This plugin is based on preCode.js by @leeoniya
Instead of writing this
<div>
<pre><code>function hellWorld() {
console.log("Hello World!");
}</code></pre>
</div>
Write this
<div>
<pre><code>
function hellWorld() {
console.log("Hello World!");
}
</code></pre>
</div>
Usage
This will work only for code blocks (pre > code) and not for inline code.
By default it adds works on all code blocks. In case you don't want a specific block to be trimmed, just add data-trim="false" to desired pre and the plugin will skip it.
PHP
<?php
use VKBansal\Spectrum\Plugin\TrimCode;
use VKBansal\Spectrum\Spectrum;
$highlighter = new Spectrum();
$highlighter->addPlugin(new TrimCode());