From 73491f14dd63612d527632210d2c3873eb81188f Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 6 Nov 2014 13:27:24 +0000 Subject: [PATCH] Update highlight plugin configuration to support tabs The technique we were using to configure the library was incorrect. --- plugins/tiddlywiki/highlight/highlightblock.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/tiddlywiki/highlight/highlightblock.js b/plugins/tiddlywiki/highlight/highlightblock.js index 9fb0c3d2a..8761b0e3f 100644 --- a/plugins/tiddlywiki/highlight/highlightblock.js +++ b/plugins/tiddlywiki/highlight/highlightblock.js @@ -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; +if($tw.browser) { + var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs; + hljs.configure({tabReplace: " "}); +} + CodeBlockWidget.prototype.postRender = function() { var domNode = this.domNodes[0]; if($tw.browser && this.document !== $tw.fakeDocument && this.language) { domNode.className = this.language.toLowerCase(); - var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs; - hljs.tabReplace = " "; hljs.highlightBlock(domNode); } };