1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Fix problem with highlighting only working in the DOM

The current implementation of the highlight plugin only works properly
in the browser, and doesn’t work under Node.js. It also doesn’t work
when rendering to the fakedom in the browser (as happens when rendering
stylesheets, for example).
This commit is contained in:
Jermolene 2014-01-27 17:10:02 +00:00
parent 70ed6e6ad3
commit 5d3dda1a17

View File

@ -31,7 +31,7 @@ Wraps up the fenced code blocks parser for highlight and use in TiddlyWiki5
parent.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode);
if($tw.browser && lang !== 'no-highlight') {
if($tw.browser && this.document !== $tw.fakeDocument && lang !== 'no-highlight') {
hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs,
hljs.tabReplace = ' ';
hljs.highlightBlock(domNode);