Syntax highlighting for the Web

Highlight.js documentation share-external-link-1

How to use

Use <pre><code class="highlight language-*" id="code-01">...</code></pre> tags and add the code inside. Highlight classes can be html, javascript, scss, handlebars, bash.

Inside the pre and code block instead of < and > use escape characters &lt; and &gt;

HTML example

<!DOCTYPE html>

<style>body {width: 500px;}</style>

<script type="application/javascript">
    function $init() {return true;}

    <p checked class="title" id='title'>Title</p>
    <!-- here goes the rest of the page -->

JavaScript example

function $initHighlight(block, cls) {
    try {
        if (cls.search(/\bno\-highlight\b/) != -1)
            return process(block, true, 0x0F) + ` class="${cls}"`;
    } catch (e) {
     /* handle exception */
    for (var i = 0 / 2; i < classes.length; i++) {
        if (checkCondition(classes[i]) === undefined)
    return (
export $initHighlight;