Skip to content

Commit a0d7a9f

Browse files
authored
Fix to non-alias xpath of xquery base for *highlight.js* dep (#1529)
* Add in some dev console messages to assist Post #1528 #1438 ; Applies to #430 ; See also highlightjs/highlight.js#1868 Auto-merge
1 parent c5cb49c commit a0d7a9f

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

libs/markdown.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var _ = require('underscore');
1010
var marked = require('marked');
1111
var hljs = require('highlight.js');
1212
var sanitizeHtml = require('sanitize-html');
13+
var colors = require('ansi-colors');
1314

1415
var isSameOrigin = require('./helpers').isSameOrigin;
1516

@@ -225,7 +226,7 @@ marked.setOptions({
225226
highlight: function (aCode, aLang) {
226227
var obj = null;
227228
var lang = [ // NOTE: More likely to less likely
228-
'javascript', 'xpath', 'xml',
229+
'javascript', 'xquery', 'xml',
229230
'css', 'less', 'scss',
230231
'json',
231232
'diff',
@@ -238,6 +239,13 @@ marked.setOptions({
238239
try {
239240
return hljs.highlight(aLang, aCode).value;
240241
} catch (aErr) {
242+
if (isDev) {
243+
console.error([
244+
colors.red('Dependency named highlighting failed with:'),
245+
aErr
246+
247+
].join('\n'));
248+
}
241249
}
242250
}
243251

@@ -248,11 +256,22 @@ marked.setOptions({
248256
return obj.value;
249257
} else {
250258
if (isDev) {
251-
console.log('Unusual auto-detected md language code is', '`' + obj.language + '`');
259+
console.log([
260+
colors.yellow('Unusual auto-detected md language code is')
261+
+ '`' + colors.cyan(obj.language) + '`',
262+
263+
].join('\n'));
252264
}
253265
return hljs.highlightAuto(aCode, lang).value;
254266
}
255267
} catch (aErr) {
268+
if (isDev) {
269+
console.error([
270+
colors.red('Dependency automatic named highlighting failed with:'),
271+
aErr
272+
273+
].join('\n'));
274+
}
256275
}
257276

258277
// If any external package failure don't block return e.g. prevent empty

0 commit comments

Comments
 (0)