When I include a JavaScript file in the preferences (Files/Markdown/JavaScript), it turns off Prism support. That is, the prism.js is not loaded anymore (prism.css is, though). This happens with a JavaScript file from the file system, didn’t check with one stored in DT itself.
Removing the JavaScript file sets everything back to normal.
Confirmed.
The Prism.js is not loading if a default JavaScript is specified.
Converting the Markdown file to HTML shows this clearly.
Does it? There’s both the expected Prism stuff plus the SCRIPT tag to load the specified JavaScript over here in the HTML source.
Ahh, indeed you are correct.
But the code / code blocks are still not rendering properly
Hard to tell without the Markdown source & the used JavaScript.
With Javascript.zip (24.2 KB)
Note I used an item link in the Markdown > Javascript preferences this time.
The Markdown, main.js
, and converted HTML file are all in there.
And my prefs…
Yes it is and they are - in DT. However, the Prism script is somehow™ missing if I open the file in Firefox. By “somehow” I mean that in the developer console, I see my script, the Prism css (kindof) and that’s it.
That’s the relevant line:
<script type="text/javascript" src="file:///Users/ck/Desktop/AddNumbering.js"/>
<style><!--
Not to be picky about it, but the script
element requires a closing tag. Like
<script type="text/javascript" src="file:///Users/ck/Desktop/AddNumbering.js"/></script>
(cf <script>: The Script element - HTML: HyperText Markup Language | MDN)
Since this closing tag is missing, everything up to the closing </script>
of the Prism.js code is considered to be part of the JS inserted by my preference … which does very efficiently turn off Prism.
Easy to fix (in the DT code, that is).
BTW: My minimalist JavaScript code adds “line-numbers” to the class of all pre
elements, so that the HTML version of the MD file would show line numbers for listings. That does work as expected in Firefox (after adding the closing tag), not so in DT. But that’s another problem.
And fixed, thanks.