An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Highlight.js Focus Plugin

This plugin provide the ability to highlight a focused line when using Highlight.js

image

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
```