A syntax highlighter filter for Moodle with the choice of either EnlighterJS or SyntaxHighlighter as the 'engine'. The administrator has 'preview' settings to see what the look will be on example code before the saving.
When active, content with a 'code' tag or 'pre code' tags within a course, module or block will be highlighted. Specifically between the Course and Block contexts.
Prior to version 39.1.0, the 'pre' tag was accepted on its own for code to be highlighted. This proved problematic with the need to have non-code preformatted but not highlighted. To highlight code now, please use the 'code' tag, and surround with a 'pre' tag to indicate a block of code. With 'EnlighterJS', using a 'code' tag on its own indicates 'inline' code. 'SyntaxHighlighter' will highlight the code in a block regardless of if there is an enclosing 'pre' tag.
Please add any configuration attributes to the 'code' tag. Such as 'EnlighterJS - HTML Attribute Options (local)' or for SyntaxHighlighter, please look at the information on the settings page.
<code data-enlighter-language="java" class="brush: java">System.out.println("SynHi");</code>
<pre><code data-enlighter-language="java" class="brush: java">
package test;
public class Test {
private final String name = "Java program";
public static void main (String args[]) {
Test us = new Test();
System.out.println(us.getName());
}
public String getName() {
return name;
}
}
</code></pre>
The SynHi filter is 'free' software under the terms of the GNU GPLv3 License, please see 'COPYING.txt'. It contains third party 'highlighers' which are licensed differenty, see 'Highlighters'.
It can be obtained for free from:
You have all the rights granted to you by the GPLv3 license. If you are unsure about anything, then the FAQ - www.gnu.org/licenses/gpl-faq.html - is a good place to look.
If you reuse any of the code then I kindly ask that you make reference to the filter.
If you make improvements or bug fixes then I would appreciate if you would send them back to me by forking from https://github.com/gjbarnard/moodle-filter_synhi and doing a 'Pull Request' so that the rest of the Moodle community benefits.
As SynHi is licensed under the GNU GPLv3 License it comes with NO support. If you would like support from me then I'm happy to provide it for a fee (please see my contact details above). Otherwise, the 'General plugins' forum is an excellent place to ask questions.
If you'd like to sponsor, get support or fund improvements, then please do get in touch via:
This version works with:
Please ensure that your hardware and software complies with 'Requirements' in 'Installing Moodle' on:
Before reporting an issue, please ensure that you are running the current version for your release of Moodle. It is essential that you are operating the required version of Moodle as stated at the top - this is because the filter relies on core functionality that is out of its control.
I operate a policy that I will fix all genuine issues for free. Improvements are at my discretion. I am happy to make bespoke customisations / improvements for a negotiated fee.
It is essential that you provide as much information as possible, the critical information being the contents of the filter's version.php file. Other version information such as specific Moodle version, theme name and version also helps. A screen shot can be really useful in visualising the issue along with any files you consider to be relevant.
Report issues on: https://github.com/gjbarnard/moodle-filter_synhi/issues
See Changes.md
iframe resize: https://stackoverflow.com/questions/9975810/make-iframe-automatically-adjust-height-according-to-the-contents-without-using
G J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE.