This Renderer Plugin allows clean formatting of computer code in your posts.
|Last tested in version:|
This plugin renders character entities on the fly, so you can cut’n-paste normal code directly into your posts and it will always look like normal code, even when editing the post (i.e., no preprocessing of the code is required). Include line numbers (customizable starting number). The best part about the line numbers - visitors can cut’n-paste the code from your post, leaving the line numbers behind! Accepts BBcode tags and doesn’t render smilies. Coloration of PHP code, plus PHP manual links for PHP functions. Easy to install and easy to use. No hacks. Degrades nicely, if the plugin is off. Styling completely customizable via an included CSS file.
- XHTML strict: If enabled this will remove the ‘ target="_blank" ‘ from the PHP documentation links.
- Display code toolbar: display code toolbar in expert mode and on comment form (individual users can override this).
In b2evolution v5 and above, it is recommended to use this plugin with a low priority (for example: 10) so that it is called before the other plugins.
One important thing that will happen is that when a post is saved (plugin event
FilterItemContents) will be fired, the plugin will transform shortcodes like
[codeblock lang="php" line="5"] into markup like
<!-- codeblock lang=php line=5 --><pre class="codeblock"><code>. This will allow for other plugins to be able to detect
<code> tags and not render/alter text within computer code.
The easiest way to use this plugin is to use its toolbar: