This is a simple filter module. It handles <code></code>
and <?php ?>
tags
so that users can post code without having to worry about escaping with <
and >
-
Install this module using the official Backdrop CMS instructions at https://backdropcms.org/guide/modules
-
Go to Configuration > Content authoring > Text formats (admin/config/content/formats). For each format on which you wish to add Code Filter:
-
Click the "Configure" link.
-
Under "Enabled filters", check the codefilter checkbox.
-
Under "Filter processing order", rearrange the filtering chain to resolve any conflicts. For example, to prevent invalid XHTML in the form of
<p><div class="codefilter">
make sure "Code filter" comes before the "Convert line breaks into HTML" filter. "Code filter" should also come after "Limit allowed HTML tags", to ensure it can output the needed tags and inline styles for syntax highlighting. -
Click the "Save configuration" button.
-
-
(optionally) Edit your theme to provide a div.codeblock style for blocks of code.
This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.
This module is currently seeking maintainers.
Ported to Backdrop by Nate Haug (https://github.com/quicksketch/)
This module was originally written for Drupal by Steven Wittens (http://acko.net/), based on the PHP filter in project.module by Kjartan Mannes (https://www.drupal.org/u/kjartan).