Highlight.js plugin for display language of syntax highlight.
npm i highlightjs-lang.js
bower install highlightjs-lang
Download plugin and include file after highlight.js:
<script src="path/to/highlight.min.js"></script>
<script src="path/to/highlightjs-lang.min.js"></script>
Adding styles:
.hljs-lang {
background: #333;
text-align: center;
color: #fff;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
Initialize plugin after highlight.js:
hljs.initHighlightingOnLoad();
hljs.initLangOnLoad();
Here’s an equivalent way to calling initLangBlock
using jQuery:
$(document).ready(function() {
$('code.hljs').each(function(i, block) {
hljs.initLangBlock(block);
});
});
© 2015 Yauheni Pakala | MIT License