Skip to content

Commit 9f3b2f8

Browse files
committed
Make autodetect work with hyphen-including language names (Fix #103)
1 parent d88d4a7 commit 9f3b2f8

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)