markdown-it-highlight-lines
Install
yarn add markdown-it-highlight-lines
Usage
const MarkdownIt = const highlightLines = const md = md md
For example, highlight line 1, 2, and line 4 to 5:
```js {1,2,4-5}function foo() { return bar() .then(res => { return res.doSomething() })}```
Note that the spaces between language name and opening curly bracket are optional.
Each highlighted line will be wrapped in <span class="highlighted-line"></span>
, you can apply some custom styles to this element, recommended:
You can tweak it a bit to suit your own needs.
A real-world example is reactjs.org, this is how it looks like:
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
markdown-it-highlight-lines © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
github.com/egoist · GitHub @EGOIST · Twitter @_egoistlily