You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

hexo-util

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.2 to 0.6.3

yarn.lock

37

lib/highlight.js

@@ -8,6 +8,2 @@ 'use strict';

hljs.configure({
classPrefix: ''
});
function highlightUtil(str, options) {

@@ -17,2 +13,3 @@ if (typeof str !== 'string') throw new TypeError('str must be a string!');

var useHljs = options.hasOwnProperty('hljs') ? options.hljs : false;
var gutter = options.hasOwnProperty('gutter') ? options.gutter : true;

@@ -24,6 +21,14 @@ var wrap = options.hasOwnProperty('wrap') ? options.wrap : true;

var tab = options.tab;
hljs.configure({ classPrefix: useHljs ? 'hljs-' : ''});
var data = highlight(str, options);
if (!wrap) return data.value;
if (useHljs && !gutter) wrap = false;
var before = useHljs ? '<pre><code class="hljs ' + options.lang + '">' : '<pre>';
var after = useHljs ? '</code></pre>' : '</pre>';
if (!wrap) return useHljs ? before + data.value + after : data.value;
var lines = data.value.split('\n');

@@ -39,5 +44,3 @@ var numbers = '';

numbers += '<span class="line">' + (firstLine + i) + '</span><br>';
content += '<span class="line';
content += (mark.indexOf(firstLine + i) !== -1) ? ' marked' : '';
content += '">' + line + '</span><br>';
content += formatLine(line, firstLine + i, mark, options);
}

@@ -57,3 +60,3 @@

result += '<td class="code"><pre>' + content + '</pre></td>';
result += '<td class="code">' + before + content + after + '</td>';
result += '</tr></table></figure>';

@@ -64,2 +67,16 @@

function formatLine(line, lineno, marked, options) {
var useHljs = options.hljs || false;
var res = useHljs ? '' : '<span class="line';
if (marked.indexOf(lineno) !== -1) {
// Handle marked lines.
res += useHljs ? '<mark>' + line + '</mark>' : ' marked">' + line + '</span>';
} else {
res += useHljs ? line : '">' + line + '</span>';
}
res += '<br>';
return res;
}
function encodePlainString(str) {

@@ -130,2 +147,4 @@ return entities.encode(str);

if (options.hljs) return hljs.highlight(lang, str);
return tryHighlight(str, result.language) || result;

@@ -132,0 +151,0 @@ }

{
"name": "hexo-util",
"version": "0.6.2",
"version": "0.6.3",
"description": "Utilities for Hexo.",

@@ -41,9 +41,9 @@ "main": "lib/index",

"dependencies": {
"bluebird": "^3.5.1",
"bluebird": "^3.4.0",
"camel-case": "^3.0.0",
"cross-spawn": "^4.0.2",
"highlight.js": "^9.12.0",
"html-entities": "^1.2.1",
"striptags": "^2.2.1"
"cross-spawn": "^4.0.0",
"highlight.js": "^9.4.0",
"html-entities": "^1.2.0",
"striptags": "^2.1.1"
}
}

@@ -92,2 +92,3 @@ # hexo-util

`firstLine` | First line number | 1
`hljs` | Whether to use the `hljs-*` prefix for CSS classes | false
`lang` | Language |

@@ -94,0 +95,0 @@ `caption` | Caption |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc