Skip to content
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 registered language name for grammar names with dash, fixes #3263. #3264

Merged
merged 3 commits into from Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/stub.js
Expand Up @@ -5,7 +5,7 @@ import * as builtIns from "builtInLanguages";
const hljs = HighlightJS;

for (const key of Object.keys(builtIns)) {
const languageName = key.replace("grmr_", "");
const languageName = key.replace("grmr_", "").replace("_", "-");
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
hljs.registerLanguage(languageName, builtIns[key]);
}
// console.log(hljs.listLanguages());
Expand Down
9 changes: 9 additions & 0 deletions test/builds/browser_build_as_commonjs.js
Expand Up @@ -21,4 +21,13 @@ API.forEach(n => {
assert(_ => keys.includes(n), `API should include ${n}`);
});

// See e.g. highlightjs/highlight.js#3263
const langs = ["python", "python-repl"]
joshgoebel marked this conversation as resolved.
Show resolved Hide resolved
langs.forEach(n => {
assert(_ => {
res = hljs.getLanguage(n);
return typeof res === 'object' && res !== null
})
})

console.log("Pass: browser build works with Node.js just fine.")