For the online learning world

Elearning WorldMoodle

SynHi revisited


Back in September 2020, I wrote about a new plugin I’d developed for syntax highlighting called ‘SynHi’. In this post I’ll revisit and explain more of my thoughts around it.


Firefox® is a registered trademark of the Mozilla Foundation.

Moodle™ is a registered trademark of ‘Martin Dougiamas’ – moodle.com/trademarks.

Other names / logos can be trademarks of their respective owners. Please review their website for details.

I am independent from the organisations mentioned and am in no way writing for or endorsed by them.

The information presented in this article is written according to my own understanding, there could be technical inaccuracies, so please do undertake your own research.



In version 39.1.1, a bug fix release of 39.1.0 which has the majority of improvements. On the surface there does not seem to be much difference, but under the hood I’ve tidied things up and cleaned the presentation of the output:

SynHi in use

The most significant change is in the use of the ‘pre’ tag. When I started to integrate the highlighters, the emphasis was on use of both the ‘pre’ and ‘code’ tags. With ‘pre’ being used for multiple lines of code and ‘code’ for small ‘inline’ snippets. This actually proved to be problematic and conflicted with ‘MathJax‘ and indeed the requirement to simply have preformatted text that was not code. Therefore I undertook some research and read what others have to say about the use of the tags: ‘Everything You Need to Know About HTML’s ‘pre’ Element’, ‘Considerations for styling the pre tag’ and ‘Bootstrap code’. Then I knew I needed to do something different.

The ‘different’ is that now blocks of code are denoted by a ‘pre’ then a ‘code’ tag and inline, simply ‘code’ only. As that now purely describes what is actually happening. In the settings of the filter, there is a the ‘Information’ page (Site administration → Plugins → Filters → SynHi → Information) I go into more detail on usage – critically, any ‘configuration attributes’ now need to be on the ‘code’ tag.

You can download and install an updated version from ‘SynHi in the Moodle plugins database’.


I’m still a believer in providing the opportunity to learn and make available to all the skill of writing software. SynHi from my point of view is a positive enabling tool in that belief. By improving and maintaining the plugin, I hope that more people are able to benefit from its use by educators.

One subtle thing that I don’t think has been spotted yet is the logo:

SynHi Logo

Which in itself does not seem like much, but ‘DNA‘ has four bases in pairs, Cytosine ‘C’, Guanine ‘G’, Adenine ‘A’ and Thymine ‘T’. And so the colours in the box are ‘Cyan’, ‘Green’, ‘Amber’ and ‘Teal’, in effect ‘code’.


Please do say what you think in the comments.

Gareth Barnard
Latest posts by Gareth Barnard (see all)

Gareth Barnard

Gareth is a developer of numerous Moodle Themes including Essential (the most popular Moodle Theme ever), Foundation, and other plugins such as course formats, including Collapsed Topics.

Add a reply or comment...