JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53208
  • Score
    100M100P100Q169959F
  • License MIT

Highlight.js line numbers plugin.

Package Exports

  • highlightjs-line-numbers.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (highlightjs-line-numbers.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

highlightjs-line-numbers.js version

Highlight.js line numbers plugin.

Usage

Download plugin and include file after highlight.js:

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

<script src="dist/highlightjs-line-numbers.min.js"></script>

Adding styles:

.hljs-line-numbers {
    text-align: right;
    border-right: 1px solid #ccc;
    color: #999;
    -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.initLineNumbersOnLoad();

Here’s an equivalent way to calling initLineNumbersOnLoad using jQuery:

$(document).ready(function() {
    $('code.hljs').each(function(i, block) {
        hljs.lineNumbersBlock(block);
    });
});

© 2015 Yauheni Pakala | MIT License