nanolight
v1.6.21
Published
‘nanolight’ is code highlighter for any programming language. Works in both Node.js and the browser. Lightweight. No dependencies.
Downloads
96
Readme
nanolight
‘nanolight’ is code highlighter for any programming language. Works in both Node.js and the browser. Lightweight. No dependencies.
Install
NPM
npm install nanolight
CDN
<script type="text/javascript" src="https://cdn.rawgit.com/jackens/nanolight/master/nanolight.js"></script>
or
<script type="text/javascript" src="https://cdn.rawgit.com/jackens/nanolight/master/nanolight.min.js"></script>
or
<script type="text/javascript" src="https://unpkg.com/nanolight/nanolight.js"></script>
or
<script type="text/javascript" src="https://unpkg.com/nanolight/nanolight.min.js"></script>
Usage
var nanolight = require('nanolight')
nanolight('var theAnswerToLifeTheUniverseAndEverything = 42')
var elements = document.getElementsByClassName('nl')
for (var i = 0; i < elements.length; i++) {
elements[i].innerHTML = nanolight(elements[i].innerText)
}
More usage examples can be found at https://jackens.github.io/.