mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-30 16:00:46 +00:00
Update highlight plugin configuration to support tabs
The technique we were using to configure the library was incorrect.
This commit is contained in:
parent
e145376838
commit
73491f14dd
@ -14,12 +14,15 @@ Wraps up the fenced code blocks parser for highlight and use in TiddlyWiki5
|
|||||||
|
|
||||||
var CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock;
|
var CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock;
|
||||||
|
|
||||||
|
if($tw.browser) {
|
||||||
|
var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs;
|
||||||
|
hljs.configure({tabReplace: " "});
|
||||||
|
}
|
||||||
|
|
||||||
CodeBlockWidget.prototype.postRender = function() {
|
CodeBlockWidget.prototype.postRender = function() {
|
||||||
var domNode = this.domNodes[0];
|
var domNode = this.domNodes[0];
|
||||||
if($tw.browser && this.document !== $tw.fakeDocument && this.language) {
|
if($tw.browser && this.document !== $tw.fakeDocument && this.language) {
|
||||||
domNode.className = this.language.toLowerCase();
|
domNode.className = this.language.toLowerCase();
|
||||||
var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs;
|
|
||||||
hljs.tabReplace = " ";
|
|
||||||
hljs.highlightBlock(domNode);
|
hljs.highlightBlock(domNode);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user