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

Core: Use language-none if no language class was detected #1858

Merged
merged 1 commit into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ var _ = {

highlightElement: function(element, async, callback) {
// Find language
var language, grammar, parent = element;
var language = 'none', grammar, parent = element;

while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}

if (parent) {
language = (parent.className.match(lang) || [,''])[1].toLowerCase();
language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();
grammar = _.languages[language];
}

Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.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 @@ -194,14 +194,14 @@ var _ = {

highlightElement: function(element, async, callback) {
// Find language
var language, grammar, parent = element;
var language = 'none', grammar, parent = element;

while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}

if (parent) {
language = (parent.className.match(lang) || [,''])[1].toLowerCase();
language = (parent.className.match(lang) || [,'none'])[1].toLowerCase();
grammar = _.languages[language];
}

Expand Down