Skip to content

Commit

Permalink
Simplify lang regex on File Highlight plugin (#1399)
Browse files Browse the repository at this point in the history
Similar to #854.
  • Loading branch information
valtlai authored and Golmote committed Apr 22, 2018
1 parent db2d0eb commit 7bc9a4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugins/file-highlight/prism-file-highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var src = pre.getAttribute('data-src');

var language, parent = pre;
var lang = /\blang(?:uage)?-(?!\*)([\w-]+)\b/i;
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}
Expand Down Expand Up @@ -87,4 +87,4 @@

document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight);

})();
})();
2 changes: 1 addition & 1 deletion plugins/file-highlight/prism-file-highlight.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ Prism.languages.js = Prism.languages.javascript;
var src = pre.getAttribute('data-src');

var language, parent = pre;
var lang = /\blang(?:uage)?-(?!\*)([\w-]+)\b/i;
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}
Expand Down Expand Up @@ -872,4 +872,4 @@ Prism.languages.js = Prism.languages.javascript;

document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight);

})();
})();

0 comments on commit 7bc9a4a

Please sign in to comment.