Problems with Syntax Highlighting in TinyMCE

Problems with Syntax Highlighting in TinyMCE

Christian Wichmann -
回帖数: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


回复Christian Wichmann

Re: Problems with Syntax Highlighting in TinyMCE

Andrew Lyons -
Core developers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 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

回复Andrew Lyons

Re: Problems with Syntax Highlighting in TinyMCE

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