Hello,
Re:
0651014/docs/api.rst#highlightautovalue-languagesubset (we use this... and thank you and your team for the longevity and expertise with this package :)b9cfc7f (Dep upgrade from *highlight.js@9.12.0 to highlight.js@9.13.0)*c5cb49c/libs/markdown.js#L225-L260 (our code where it currently works in *highlight.js@9.12.0 but __not__ highlight.js@9.13.0 which is currently on production. Using a limited Array of Strings.)*Spec:
$ node -v
v10.12.0
NOTES:
Thanks for the look.
Hi @Martii
The problem is in xpath. There is no such language in highlightjs:
highlight: function (aCode, aLang) {
var obj = null;
var lang = [ // NOTE: More likely to less likely
'javascript', 'xpath', 'xml', // <------- remove xpath
'css', 'less', 'scss',
'json',
'diff',
'shell',
'bash', 'dos',
'vbscript'
];
In 9.12 this fact was silently ignored, but now we throw an error. Probably we should not.
So, quick fix for you is to remove xpath from the list of languages.
@egor-rogov
The problem is in
xpath. There is no such language in highlightjs
That did the trick. Will push to dev. Thank you! Could have sworn that I validated all the language names but I'm only human. ;) :)
In 9.12 this fact was silently ignored, but now we throw an error.
Looks like I'll need to add a few more dev console messages to track this. :) Good to know.
Thanks a bazillion!
Hmm just trapped on local dev and nothing thrown. : Oh well... I'm ready for rest and will tackle our issue later.
Okay I'm stubborn... trapped every layer of our code, and several hard refreshes of my browser, and got this:
TypeError: Cannot read property 'disableAutodetect' of undefined
at autoDetection (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/highlight.js/lib/highlight.js:711:29)
at Array.filter (<anonymous>)
at Object.highlightAuto (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/highlight.js/lib/highlight.js:572:40)
at Object.highlight (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/libs/markdown.js:261:21)
at Renderer.code (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/marked/lib/marked.js:920:28)
at Parser.tok (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/marked/lib/marked.js:1199:28)
at Parser.parse (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/marked/lib/marked.js:1144:17)
at Function.Parser.parse (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/marked/lib/marked.js:1126:17)
at marked (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/marked/lib/marked.js:1533:19)
at exports.renderMd (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/libs/markdown.js:285:10)
at exports.renderComment (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/libs/modelParser.js:719:30)
at Function._.map._.collect (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/underscore/underscore.js:205:24)
at preRender (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/controllers/issue.js:240:13)
at asyncComplete (~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/controllers/issue.js:254:11)
at ~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/async/dist/async.js:3888:9
at ~/repo/git/OpenUserJS.org/martii/OpenUserJS.org/node_modules/async/dist/async.js:473:16
... that's not quite the stack trace I was thinking I was going to get... disableAutodetect of undefined.
Anyhow... removing the xpath seems to do the trick for now.
The problem is in
xpath. There is no such language in highlightjs
There should be... it's listed at the tail end of https://github.com/highlightjs/highlight.js/blob/82c22c6da9f591510f041d2047c0a5b7e9886370/docs/css-classes-reference.rst#language-names-and-aliases.
See XQuery | xpath, xq.
I'm going to reopen this as this is darn peculiar.
Ah, I see. It doesn't accept aliases (and never did), so use xquery instead.
Please leave the issue open, we'll need to rethink this. Probably we should accept aliases as well.
Okay, basically we have two options here:
1. Update the docs to reflect the current behavior (i. e. that highlightAuto() and configure() don't accept aliases). Previously aliases were accepted but ignored (that's too bad), now an error occurs. This change appeared quite accidentally, it wasn't planned.
(2) is doable but seems not worth the effort. It shouldn't be a big problem for the caller to specify a right name. So I'm inclined to (1).
@marcoscaceres what do you think?
I'm wrong, sorry for the buzz. That's my bug :( Will fix it.
Most helpful comment
Ah, I see. It doesn't accept aliases (and never did), so use
xqueryinstead.Please leave the issue open, we'll need to rethink this. Probably we should accept aliases as well.