sharpchi / moodle-filter_syntaxhighlighter

14 stars 10 forks source link

Auto-detection of MATLAB language fails #9

Closed abias closed 4 years ago

abias commented 4 years ago

Hi Mark,

one of our teachers reported that the auto-detection of MATLAB code fails. Especially, the example MATLAB code from https://highlightjs.org/static/demo/ is recognized as Makefile: Kurs__Alex__Sandkasten

Upstream in highlight.js, there is just one issue covering this issue on https://github.com/highlightjs/highlight.js/issues/819 - but it deals with file extensions and in Moodle the rendered code does not have any file extensions.

I am aware that you are saying on https://moodle.org/plugins/filter_syntaxhighlighter that there isn't any mechanism to force the language to be used, but the MATLAB issue brings me to a point where I think that this could indeed be useful or even needed.

Do you have an opinion or solution proposal for this catch-22?

Cheers, Alex

sharpchi commented 4 years ago

Finally looking at this. I have a pull request to be able to specify a language #11 . I think this will go part the way to fixing your issue. And I noticed that the js I include doesn't contain the language matlab, so I'll look to make sure that's included. I might include a bunch of other languages.

sharpchi commented 4 years ago

Updated to latest version, and included matlab. Autodetection should work, however, you can also now specify the language using ```lang:matlab;; my matlab code ``` notation