Problems with Syntax Highlighting in TinyMCE

Problems with Syntax Highlighting in TinyMCE

by Christian Wichmann -
Number of replies: 2

Hi,

I would like to use syntax highlighting for my programming course and saw that TinyMCE is supporting this function. So I created a text page and added a code snippet. Inside the editor the code is highlighted and looks really nice:


But after saving the page it looks just like normal text (monospaced, but not highlighted):


Is this a configuration error? Do I need an extra plugin for this? We are using Moodle 4.1 and TinyMCE 6.2.0, by the way.

Thanks for your help in advance.

Best regards,

  Christian


Average of ratings: -
In reply to Christian Wichmann

Re: Problems with Syntax Highlighting in TinyMCE

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Christian,

Thank you for raising this question.

The code highlighting feature was not a part of the original TinyMCE integration but was added later via MDL-75963 in Moodle version 4.3.

In theory it should be possible to install that plugin in an older version of Moodle with a very minor change to the version requirements. I'll see if we can get this added to the plugins database too.

Andrew

Average of ratings: Useful (2)
In reply to Andrew Lyons

Re: Problems with Syntax Highlighting in TinyMCE

by Christian Wichmann -

Hi Andrew,

thanks for your quick reply and for working on this feature! I just tested the highlighting in my test site on Moodle 4.3 and it looks really good.

It would be cool if the filter could be installed from the plugin database for older versions, because we are currently still using the version 4.1 and I can't update myself.

Best regards,
    Christian