Skip to content

Commit

Permalink
The data-language attribute is no longer of any use, so remove it fro…
Browse files Browse the repository at this point in the history
…m the code.

It was only applicable when using CSS pseudo elements to show the language name, which is no longer the case.
  • Loading branch information
nauzilus committed Dec 17, 2015
1 parent 2a21d56 commit eb9a83c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ div.prism-show-language {
position: relative;
}

div.prism-show-language > div.prism-show-language-label[data-language] {
div.prism-show-language > div.prism-show-language-label {
color: black;
background-color: #CFCFCF;
display: inline-block;
Expand Down
9 changes: 2 additions & 7 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Prism.hooks.add('before-highlight', function(env) {
return;
}
var language = Languages[env.language] || (env.language.substring(0, 1).toUpperCase() + env.language.substring(1));
pre.setAttribute('data-language', language);

/* check if the divs already exist */
var sib = pre.previousSibling;
Expand All @@ -21,23 +20,19 @@ Prism.hooks.add('before-highlight', function(env) {
sib.firstChild &&
/\s*\bprism-show-language-label\b\s*/.test(sib.firstChild.className)) {
div2 = sib.firstChild;
if (div2.getAttribute('data-language') !== language) {
div2.setAttribute('data-language', language);
div2.innerHTML = language;
}
} else {
div = document.createElement('div');
div2 = document.createElement('div');

div2.className = 'prism-show-language-label';
div2.setAttribute('data-language', language);
div2.innerHTML = language;

div.className = 'prism-show-language';
div.appendChild(div2);

pre.parentNode.insertBefore(div, pre);
}

div2.innerHTML = language;
});

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

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

0 comments on commit eb9a83c

Please sign in to comment.