mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-18 15:54:50 +00:00
ecba4f71ea
Fixing various issues that were preventing language specifiers from working.
28 lines
709 B
JavaScript
28 lines
709 B
JavaScript
/*\
|
|
title: $:/plugins/tiddlywiki/highlight/highlightblock.js
|
|
type: application/javascript
|
|
module-type: widget
|
|
|
|
Wraps up the fenced code blocks parser for highlight and use in TiddlyWiki5
|
|
|
|
\*/
|
|
(function() {
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"use strict";
|
|
|
|
var CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock;
|
|
|
|
CodeBlockWidget.prototype.postRender = function() {
|
|
var domNode = this.domNodes[0];
|
|
if($tw.browser && this.document !== $tw.fakeDocument && this.language) {
|
|
domNode.className = this.language;
|
|
var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js").hljs;
|
|
hljs.tabReplace = " ";
|
|
hljs.highlightBlock(domNode);
|
|
}
|
|
};
|
|
|
|
})();
|