New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(parser) Make language alias registration case insensitive #3026
fix(parser) Make language alias registration case insensitive #3026
Conversation
Upstream discussion is here: [1]. |
This will not fix: The problem is that your installation of Highlight.js is not loading the It's possible you think you've fixed it locally because you're using a different build of the library than is being used in production? But that error would not be shown if latex was loaded and registered. This might still be a reasonable PR but I'm going to briefly noodle over whether we simply shouldn't make aliases case-insensitive rather than having this type of issue continue to come up. |
I have not experienced this issue. I debugged gerrit@HEAD and it turned out, that this /**
* @param {string} name - name of the language to retrieve
* @returns {Language | undefined}
*/
function getLanguage(name) {
name = (name || '').toLowerCase();
return languages[name] || languages[aliases[name]];
} returned undefined for
Gerrit build instruction for
Now, grepping for $ grep -i latex build/highlight.min.js
hljs.registerLanguage("latex",(()=>{"use strict";return e=>{const n=[{
});return{name:"LaTeX",aliases:["tex","TeX"], With the diff from this PR the highlighting of Also in https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md no additional packages are listed for LaTeX mode. What am I missing? |
Ah, ok we're talking about different issues then.
Ah yes, thank for running this down. :-)
Ugh. So we're already normalizing aliases at request/runtime, but not at registration time. I think the fix we truly need here is in aliasList.forEach(alias => { aliases[alias.toLowerCase()] = languageName; }); If the lookup is downcase, then the registration should be also. Could you confirm if this also resolves your issue and perhaps update the PR if so? |
This reverts commit 3b96cdc.
Yes.
Done. |
Please give yourself some credit in CHANGES.md. :) Otherwise looks good. |
Done. |
@davido Thanks! |
Add tex files to gr-syntax-layer's language map. Also update hljs to d24895f4 to include this fix: [1] fix(parser) Make language alias registration case insensitive [1] highlightjs/highlight.js#3026 Bug: Issue 14091 Change-Id: I41f855703f0a9d70b6aebd2a337f1c4c7bf91904
Changes
Checklist
CHANGES.md
AUTHORS.txt
, under Contributors