@@ -18,10 +18,10 @@ npm install highlightjs-line-numbers.js
1818
1919#### Getting the library from CDN
2020``` html
21- <script src =" //cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.6 .0/highlightjs-line-numbers.min.js" ></script >
21+ <script src =" //cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.7 .0/highlightjs-line-numbers.min.js" ></script >
2222```
2323``` html
24- <script src =" //cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.6 .0/dist/highlightjs-line-numbers.min.js" ></script >
24+ <script src =" //cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.7 .0/dist/highlightjs-line-numbers.min.js" ></script >
2525```
2626
2727## Usage
@@ -52,7 +52,7 @@ $(document).ready(function() {
5252If your needs cool style, add styles by taste:
5353``` css
5454/* for block of numbers */
55- .hljs-ln td .hljs-ln -numbers {
55+ .hljs-ln-numbers {
5656 -webkit-touch-callout : none ;
5757 -webkit-user-select : none ;
5858 -khtml-user-select : none ;
@@ -70,7 +70,7 @@ If your needs cool style, add styles by taste:
7070}
7171
7272/* for block of code */
73- .hljs-ln td .hljs-ln -code {
73+ .hljs-ln-code {
7474 padding-left : 10px ;
7575}
7676```
@@ -95,5 +95,19 @@ hljs.initLineNumbersOnLoad({
9595hljs .lineNumbersBlock (myCodeBlock, myOptions);
9696```
9797
98+ ## CSS selectors
99+
100+ You may need to select some lines of code after rendering. For instance, you may want
101+ to highlight a range of lines, selected by users, by changing their background color.
102+ The CSS selectors below can be used to perform these selection operations.
103+
104+ CSS selector | description
105+ -----------------------------------------|-----------------------
106+ ` .hljs-ln-line ` | Select all lines, including line numbers
107+ ` .hljs-ln-numbers ` | Select all line numbers, excluding lines of code
108+ ` .hljs-ln-code ` | Select all lines of code, excluding line numbers
109+ ` .hljs-ln-line[data-line-number="i"] ` | Select the ith line, including line number
110+ ` .hljs-ln-numbers[data-line-number="i"] ` | Select the ith line number, excluding the line of code
111+ ` .hljs-ln-code[data-line-number="i"] ` | Select the ith line of code, excluding the line number
98112---
99113© ; 2018 Yauheni Pakala | MIT License
0 commit comments