Tiny JavaScript Syntax Highlighter

Category: Javascript | June 15, 2020
Views Total:1,260 views
Official Page:Go to website
Last Update:June 15, 2020


Tiny JavaScript Syntax Highlighter


A tiny and easy-to-use syntax highlighter created only for JavaScript code.

How to use it:

1. Download the package and import the index.js into the HTML.

<script src="script.js"></script>

2. Wrap JavaScript snippets into code tag and done.

  // CSSScript.com
  function highlightAll(){
  var allCodes = document.getElementsByTagName("code");
  for (var i = 0; i < allCodes.length; i++) {
    allCodes[i].className = "code";
    allCodes[i].innerHTML = highlight(allCodes[i].innerHTML);

You Might Be Interested In:

Leave a Reply