mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-04 15:57:07 +00:00
[5.4.0] Update highlightjs plugin (#9118)
* Bump highlightjs version to 11.11.1 * highlightblock.js support es6
This commit is contained in:
@@ -8,11 +8,11 @@ Wraps up the fenced code blocks parser for highlight and use in TiddlyWiki5
|
||||
\*/
|
||||
"use strict";
|
||||
|
||||
var TYPE_MAPPINGS_BASE = "$:/config/HighlightPlugin/TypeMappings/";
|
||||
const TYPE_MAPPINGS_BASE = "$:/config/HighlightPlugin/TypeMappings/";
|
||||
|
||||
var CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock;
|
||||
const CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock;
|
||||
|
||||
var hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js");
|
||||
const hljs = require("$:/plugins/tiddlywiki/highlight/highlight.js");
|
||||
|
||||
if(hljs.getLanguage !== undefined) {
|
||||
// load language definitions
|
||||
@@ -33,7 +33,7 @@ if(hljs.getLanguage !== undefined) {
|
||||
if($tw.browser && !domNode.isTiddlyWikiFakeDom) {
|
||||
hljs.highlightElement(domNode.children[0]);
|
||||
} else {
|
||||
var text = domNode.textContent;
|
||||
const text = domNode.textContent;
|
||||
domNode.children[0].innerHTML = hljs.highlight(text,{language: language, ignoreIllegals: true}).value;
|
||||
// If we're using the fakedom then specially save the original raw text
|
||||
if(domNode.isTiddlyWikiFakeDom) {
|
||||
|
||||
Reference in New Issue
Block a user