Skip to content

Commit 98ca4f2

Browse files
authored
Merge pull request #63 from wcoder/dev
👍New version 2.7.0
2 parents 3bd0195 + e2c29ea commit 98ca4f2

7 files changed

+4613
-17
lines changed

Diff for: README.md

+18-4
Original file line numberDiff line numberDiff line change
@@ -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() {
5252
If 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({
9595
hljs.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
&copy; 2018 Yauheni Pakala | MIT License

Diff for: bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "highlightjs-line-numbers.js",
3-
"version": "2.6.0",
3+
"version": "2.7.0",
44
"homepage": "https://github.com/wcoder/highlightjs-line-numbers.js",
55
"authors": [
66
"Yauheni Pakala <[email protected]>"

Diff for: dist/highlightjs-line-numbers.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "highlightjs-line-numbers.js",
3-
"version": "2.6.0",
3+
"version": "2.7.0",
44
"description": "Highlight.js line numbers plugin.",
55
"main": "src/highlightjs-line-numbers.js",
66
"dependencies": {},
77
"devDependencies": {
88
"gulp": "^4.0.0",
9-
"gulp-rename": "^1.2.2",
9+
"gulp-rename": "^1.4.0",
1010
"gulp-replace": "^0.6.1",
1111
"gulp-uglify": "^1.2.0"
1212
},

0 commit comments

Comments
 (0)