Skip to content

Commit

Permalink
Merge pull request #63 from wcoder/dev
Browse files Browse the repository at this point in the history
👍New version 2.7.0
  • Loading branch information
wcoder authored Mar 17, 2019
2 parents 3bd0195 + e2c29ea commit 98ca4f2
Show file tree
Hide file tree
Showing 7 changed files with 4,613 additions and 17 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ npm install highlightjs-line-numbers.js

#### Getting the library from CDN
```html
<script src="//cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.6.0/highlightjs-line-numbers.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.7.0/highlightjs-line-numbers.min.js"></script>
```
```html
<script src="//cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.6.0/dist/highlightjs-line-numbers.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/highlightjs-line-numbers.js@2.7.0/dist/highlightjs-line-numbers.min.js"></script>
```

## Usage
Expand Down Expand Up @@ -52,7 +52,7 @@ $(document).ready(function() {
If your needs cool style, add styles by taste:
```css
/* for block of numbers */
.hljs-ln td.hljs-ln-numbers {
.hljs-ln-numbers {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
Expand All @@ -70,7 +70,7 @@ If your needs cool style, add styles by taste:
}

/* for block of code */
.hljs-ln td.hljs-ln-code {
.hljs-ln-code {
padding-left: 10px;
}
```
Expand All @@ -95,5 +95,19 @@ hljs.initLineNumbersOnLoad({
hljs.lineNumbersBlock(myCodeBlock, myOptions);
```

## CSS selectors

You may need to select some lines of code after rendering. For instance, you may want
to highlight a range of lines, selected by users, by changing their background color.
The CSS selectors below can be used to perform these selection operations.

CSS selector | description
-----------------------------------------|-----------------------
`.hljs-ln-line` | Select all lines, including line numbers
`.hljs-ln-numbers` | Select all line numbers, excluding lines of code
`.hljs-ln-code` | Select all lines of code, excluding line numbers
`.hljs-ln-line[data-line-number="i"]` | Select the ith line, including line number
`.hljs-ln-numbers[data-line-number="i"]` | Select the ith line number, excluding the line of code
`.hljs-ln-code[data-line-number="i"]` | Select the ith line of code, excluding the line number
---
&copy; 2018 Yauheni Pakala | MIT License
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "highlightjs-line-numbers.js",
"version": "2.6.0",
"version": "2.7.0",
"homepage": "https://github.com/wcoder/highlightjs-line-numbers.js",
"authors": [
"Yauheni Pakala <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion dist/highlightjs-line-numbers.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "highlightjs-line-numbers.js",
"version": "2.6.0",
"version": "2.7.0",
"description": "Highlight.js line numbers plugin.",
"main": "src/highlightjs-line-numbers.js",
"dependencies": {},
"devDependencies": {
"gulp": "^4.0.0",
"gulp-rename": "^1.2.2",
"gulp-rename": "^1.4.0",
"gulp-replace": "^0.6.1",
"gulp-uglify": "^1.2.0"
},
Expand Down
Loading

0 comments on commit 98ca4f2

Please sign in to comment.