mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Yet more tweaks to the highlight.js integration
Now we check that the selected language is supported before we invoke highlight.js; left to its own devices, it crashes…
This commit is contained in:
parent
796e59e0dc
commit
28b861451b
@ -1,6 +1,5 @@
|
|||||||
title: $:/config/HighlightPlugin/TypeMappings/
|
title: $:/config/HighlightPlugin/TypeMappings/
|
||||||
|
|
||||||
text/plain:
|
|
||||||
application/javascript: javascript
|
application/javascript: javascript
|
||||||
application/json: json
|
application/json: json
|
||||||
text/css: css
|
text/css: css
|
||||||
|
@ -27,7 +27,7 @@ CodeBlockWidget.prototype.postRender = function() {
|
|||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
language = tiddler.fields.text || "";
|
language = tiddler.fields.text || "";
|
||||||
}
|
}
|
||||||
if(language) {
|
if(language && hljs.listLanguages().indexOf(language) !== -1) {
|
||||||
domNode.className = language.toLowerCase() + " hljs";
|
domNode.className = language.toLowerCase() + " hljs";
|
||||||
if($tw.browser && !domNode.isTiddlyWikiFakeDom) {
|
if($tw.browser && !domNode.isTiddlyWikiFakeDom) {
|
||||||
hljs.highlightBlock(domNode);
|
hljs.highlightBlock(domNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user