mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-02-01 22:07:41 +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:
2461
plugins/tiddlywiki/highlight/files/highlight.min.js
vendored
2461
plugins/tiddlywiki/highlight/files/highlight.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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) {
|
||||
|
||||
@@ -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]].
|
||||
|
||||
|
||||
Reference in New Issue
Block a user