Skip to content

highlightjs-plugins/highlightjs-lang.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

highlightjs-lang.js

Highlight.js plugin for display language of syntax highlight.

DEMO

Install

Npm

npm i highlightjs-lang.js

Bower

bower install highlightjs-lang

Usage

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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy