Open pmudry opened 1 year ago
No idea how to solve this either.
I digged a bit into the problem. The HTML output by Moodle from the Markdown is as follows :
<pre><code class="scala">class Car() {
var color : String = ""
var maxSpeed : Int = -1
var model : String = ""
def getStringRepresentation(): String ={
s"$model $color, vitesse max $maxSpeed km/h"
}
}
</code></pre>
I tried modifying toolbox.php
line 241 to
'theinit' => "EnlighterJS.init('synhi pre', 'synhi code', {theme: '".$config->enlighterjsstyle."', indent : 4});"
to
'theinit' => "EnlighterJS.init('synhi pre code.scala', 'synhi code', {theme: '".$config->enlighterjsstyle."', indent : 4});"
Doing so, the class
text is removed properly. However, highlighting is no longer working properly (dark background) and I fear having side-effects. Does this help a bit ?
I would love to help you find a solution but I have no idea how to develop Moodle plugins...
@pmudry Sure there is a rule that no 'code' in 'pre', so if so then filter out.
@pmudry Still not sure how to fix this. Is it not the issue with the markdown? Aside from the Moodle code, what is the ideal logic / solution?
@pmudry Humm, what if the 'pre' tag was stripped when combined with a 'code' tag before being highlighted.
@pmudry Please upgrade to the next release 39.1.1 and this should be fixed.
Hi !
When using the Moodle markdown text processor, code blocks are rendered correctly but they include the
<code>
tag.Example :
Is rendered as :
The problem is probably because the Markdown preprocessor first creates a
<pre>
tag in which a<code>
tag is embedded. I don't know how to solve this however.Cheers !