Comparing version 0.1.2 to 0.1.3
@@ -33,3 +33,3 @@ var hljs; | ||
result += '<figure class="highlight ' + data.language + '">'; | ||
result += '<figure class="highlight' + (data.language ? ' ' + data.language : '') + '">'; | ||
@@ -73,13 +73,21 @@ if (caption){ | ||
function highlight(str, lang){ | ||
if (!lang || !hljs.getLanguage(lang)) return hljs.highlightAuto(str); | ||
if (!lang) return hljs.highlightAuto(str); | ||
var result = {value: str}; | ||
lang = lang.toLowerCase(); | ||
if (lang === 'plain'){ | ||
return {language: lang, value: str}; | ||
result.language = lang; | ||
return result; | ||
} | ||
if (!hljs.getLanguage(lang)){ | ||
return result; | ||
} | ||
try { | ||
return hljs.highlight(lang.toLowerCase(), str); | ||
return hljs.highlight(lang, str); | ||
} catch (err){ | ||
return hljs.highlightAuto(str); | ||
return result; | ||
} | ||
} |
{ | ||
"name": "hexo-util", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Utilities for Hexo.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25636
420