[5.4.0] Update highlightjs plugin (#9118)

* Bump highlightjs version to 11.11.1

* highlightblock.js support es6
This commit is contained in:
XLBilly
2025-10-29 19:04:53 +08:00
committed by GitHub
parent 23f0a9bf79
commit ec81d6663b
3 changed files with 1157 additions and 1314 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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) {

View File

@@ -1,6 +1,6 @@
title: $:/plugins/tiddlywiki/highlight/readme
\define highlightVersion() 11.4.0
\define highlightVersion() 11.11.1
This plugin provides syntax highlighting of code blocks using version <<highlightVersion>> of [[highlight.js|https://github.com/isagalaev/highlight.js]] from Ivan Sagalaev. This plugin does not work on browsers that do not fully support ~JavaScript ES6 (2015). If you need highlight.js running on those legacy browsers, you would need to install the "Highlight (Legacy)" plugin instead. Here's a [[ES6 compatibility table|https://caniuse.com/?search=es6]].