mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 07:32:59 +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:
		| @@ -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); | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jermolene
					Jermolene