https://github.com/huytd/highlightjs-focus
Line focus plugin for Highlight.js
https://github.com/huytd/highlightjs-focus
highlightjs plugin
Last synced: 6 months ago
JSON representation
Line focus plugin for Highlight.js
- Host: GitHub
- URL: https://github.com/huytd/highlightjs-focus
- Owner: huytd
- Created: 2022-02-04T22:38:07.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T17:01:46.000Z (almost 3 years ago)
- Last Synced: 2024-11-14T21:13:54.597Z (about 1 year ago)
- Topics: highlightjs, plugin
- Language: TypeScript
- Homepage:
- Size: 339 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Highlight.js Focus Plugin
This plugin provide the ability to highlight a focused line when using Highlight.js

To use, first, register this plugin with `addPlugin` command:
```js
hljs.addPlugin(new LineFocusPlugin({
focusedStyle: {
borderLeft: "2px solid #78e08f55",
background: "#78e08f05",
padding: "2px",
paddingLeft: "10px",
},
unfocusedStyle: {
borderLeft: "2px solid transparent",
paddingLeft: "10px",
opacity: "0.5",
filter: "grayscale(1)"
}
}));
```
Then in your code, or in your markdown source, add the language with the format:
```
@focus=
```
For example:
```
js@focus=5,8:12,14
```