Syntax Highlighter

Filters ::: filter_syntaxhighlighter
Maintained by Mark Sharp
This is a filter plugin that uses a 3rd party Javascript module called highlight.js to make your code look like something you'd see in an IDE.
Latest release:
794 sites
33 fans
Current versions available: 3

This is a filter plugin that uses a 3rd party Javascript module called highlight.js to make your code look like something you'd see in an IDE.

Once activated, you just need to wrap your code in:


(You will need to activate html mode in Atto), or wrap your code in triple backticks (like MarkDown) ``` and the javascript will style it. 

The settings allows you to choose which style to use.


  1. Unzip
  2. Copy contents to /filter/syntaxhighlighter
  3. Activate from Manage filters.

Change requests

Since this is a 3rd party plugin, any change requests that relate to the the styles and features of the highlighting should be directed to the plugin author.

Before you ask...

Can I specify which language I'm using?

You don't need to, the plugin detects that itself. However, you can choose the language by adding it after the backticks. e.g.

echo "My PHP code";

Or, by adding it to the <code> class attribute:

<pre><code class="lang-php">echo "My PHP code";</code></pre>
Can I have line numbering?

No. This isn't a feature of the javascript plugin. And probably isn't going to be implemented.

Can I use some other highlighting plugin?

I might implement the option of using various hightlighting plugins in the future - such as GeSHi. But this suits my needs for now. You're welcome to do a pull request with any adaptions you would like to add.


Screenshot #0
Screenshot #1
Screenshot #2


Mark Sharp (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Martin Lopez
    Fri, May 14, 2021, 5:30 AM
    Hi Mark is there any possibility to force an specific syntax? Im posting wxmaxima code and sometimes renders fine others dont. Thanks!
  • Mark Sharp
    Fri, May 14, 2021, 3:26 PM
    Hi Martin, yes you can force the language by using the following syntax:
    echo "Hello world!";
    At the moment I've not included maxima, but there might be something that's similar.
    The list of languages and help on the syntax is in the readme file which you can also read on the github page:
  • Martin Lopez
    Sat, May 15, 2021, 12:00 AM
    Thanks a lot Mark! My bad not to explore READMEmd in github ;)
  • pitou col
    Mon, Jan 31, 2022, 4:36 PM
    Hello Mark
    is there a way not to interpret the html tags ? When including them into code, they are interpreted and not displayed as code. Thanks
  • Mark Sharp
    Mon, Jan 31, 2022, 4:46 PM
    Hi @pitou col I've just tested this myself, and it works fine. Could you test again with some more details, and post it on the issue tracker -
  • Anisa Dewi
    Wed, Oct 19, 2022, 8:08 PM
    thank you for any contributions for this great plugin.
    I would like to know, did you plan a new release for Moodle 4.x and when will it be published?

    Best regards,
  • Mark Sharp
    Wed, Oct 19, 2022, 8:38 PM
    Hi Anisa, I've just run the tests against M4.0 and all appears to function as before, so I've included Moodle 4 .0 in the compatibility list.
  • Jean-Pierre Mouret
    Tue, Nov 29, 2022, 4:23 AM
    I have tested the plugin with 4.1. No problems.
  • Jean-Pierre Mouret
    Tue, Nov 29, 2022, 4:33 AM
    BTW: All plugins I use under 4.0 also work under 4.1, I think there is no problem. (On git 4.1 has therefore also probably the version 401).
  • Mark Sharp
    Tue, Nov 29, 2022, 5:20 PM
    Thanks @Jean-Pierre for testing that. I've only just started testing M4.1. I'll bump the compatibility.
  • Cuong Nguyen Viet
    Fri, Aug 25, 2023, 8:54 PM
    Anyone being duplicate course data when import this plugin on moodle 4.2.0?
  • Mark Sharp
    Fri, Aug 25, 2023, 9:18 PM
    Hi Cuong, could you reproduce the steps (with examples) that led to this error please, and report them at so I can keep a track? thanks
  • Mosaab Alsiddig
    Tue, Feb 13, 2024, 11:54 PM
    While GeSHi has more advanced options like "copy code" but it has runtime error, that why I uninstalled it and install this great plugin, and it work like a charm in 4.2 and 4.3 , I hope if the developer come back and add more features
  • Elena Virtanen
    Tue, Mar 5, 2024, 4:05 PM
    Hi Mark! Thank you so much for handy and helpful Syntax highlighter! It's awesome!
    I use it on Moodle 4.1, and it works great. But I also want to update my platform to Moodle 4.3 version and continue to use your plugin there. Is there any opportunity to use your plugin on Moodle 4.3 or maybe there are other paths to highlight a syntax? Are you going to make a new version of your plugin compatible with Moodle 4.3?
  • Elena Virtanen
    Wed, Mar 6, 2024, 4:30 AM
    I withdraw my previous question. Have already updated and tested plugin in Moodle 4.3. It works! smile
1 2
Please login to post comments