Skip to content

Line number plugin for Highlight.js to show line numbers on every code block automatically.

License

Notifications You must be signed in to change notification settings

taufik-nurrohman/highlight.ln.js

Repository files navigation

Line Number Plugin for Highlight.js

highlight.ln.js

Demo

Usage

Browser

<script src="highlight.min.js"></script>
<script src="highlight.ln.js/index.min.js"></script>
<script>
  hljs.highlightAll();
</script>

Node.js

import hljs from 'highlight.js/lib/core';
import css from 'highlight.js/lib/languages/css';

import LineNumberPlugin from '@taufik-nurrohman/highlight.ln.js';

hljs.addPlugin(LineNumberPlugin);

hljs.registerLanguage('css', css);

hljs.highlightAll();

CommonJS

const hljs = require('highlight.js/lib/core');
const css = require('highlight.js/lib/languages/css');

const LineNumberPlugin = require('@taufik-nurrohman/highlight.ln.js').default;

hljs.addPlugin(LineNumberPlugin);

hljs.registerLanguage('css', css);

hljs.highlightAll();

License

BSD