Skip to content

Commit f4e1121

Browse files
authored
Merge pull request #171 from WebCoder49/autodetect-fix
Make autodetect work with language names including hyphens (Fix #103)
2 parents d88d4a7 + 9f3b2f8 commit f4e1121

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugins/autodetect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ codeInput.plugins.Autodetect = class extends codeInput.Plugin {
1919
afterHighlight(codeInput) {
2020
let langClass = codeInput.codeElement.className || codeInput.preElement.className;
2121
let lang = langClass.match(/lang(\w|-)*/i)[0]; // Get word starting with lang...; Get outer bracket
22-
lang = lang.split("-")[1];
22+
lang = lang.match(/(?<=-)(\w|-)*/i)[0];
2323
if(lang == "undefined") {
2424
codeInput.removeAttribute("language");
2525
codeInput.removeAttribute("lang");

0 commit comments

Comments
 (0)