Comparing version 0.1.6 to 0.1.7
@@ -15,6 +15,5 @@ 'use strict'; | ||
var firstLine = options.hasOwnProperty('firstLine') ? +options.firstLine : 1; | ||
var lang = options.lang; | ||
var caption = options.caption; | ||
var tab = options.tab; | ||
var data = highlight(str, lang); | ||
var data = highlight(str, options); | ||
@@ -75,5 +74,14 @@ if (!wrap) return data.value; | ||
function highlight(str, lang){ | ||
if (!lang) return hljs.highlightAuto(str); | ||
function highlight(str, options){ | ||
var lang = options.lang; | ||
var autoDetect = options.hasOwnProperty('autoDetect') ? options.autoDetect : true; | ||
if (!lang) { | ||
if (autoDetect) { | ||
return hljs.highlightAuto(str); | ||
} else { | ||
lang = 'plain'; | ||
} | ||
} | ||
var result = {value: ent.encode(str)}; | ||
@@ -100,2 +108,2 @@ lang = lang.toLowerCase(); | ||
} | ||
} | ||
} |
{ | ||
"name": "hexo-util", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Utilities for Hexo.", | ||
@@ -40,4 +40,4 @@ "main": "lib/index", | ||
"ent": "^2.2.0", | ||
"highlight.js": "^8.4.0" | ||
"highlight.js": "^8.6.0" | ||
} | ||
} |
@@ -40,5 +40,6 @@ # hexo-util | ||
`first_line` | First line number | 1 | ||
`lang` | Language (Auto detect if not defined) | | ||
`lang` | Language | | ||
`caption` | Caption | | ||
`tab`| Replace tabs | | ||
`autoDetect` | Detect language automatically | true | ||
@@ -45,0 +46,0 @@ ### htmlTag(tag, attrs, text) |
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
27926
527
194
Updatedhighlight.js@^8.6.0