Line Numbers

Line number at the beginning of code lines.

How to use

Obviously, this is supposed to work only for code blocks (<pre><code>) and not for inline code.

Add class line-numbers to your desired <pre> and line-numbers plugin will take care.

Optional: You can specify the data-start (Number) attribute on the <pre> element. It will shift the line counter.

Optional: To support multiline line numbers using soft wrap add css white-space to pre-line or pre-wrap.

Examples

JavaScript



  

CSS



  

HTML

Please note the data-start="-5" in the code below.



  

Unknown languages

This raw text
is not highlighted
but it still has
lines numbers

Soft wrap support