# Highlight a line or a set of lines on a code snippet

**URL:** https://talk.jekyllrb.com/t/highlight-a-line-or-a-set-of-lines-on-a-code-snippet/2136
**Category:** Uncategorized
**Created:** [September 5, 2018, 9:03am UTC](https://talk.jekyllrb.com/t/highlight-a-line-or-a-set-of-lines-on-a-code-snippet/2136 "2018-09-05T09:03:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vinyanalista](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/vinyanalista/32/1212_2.png) [@vinyanalista](https://talk.jekyllrb.com/u/vinyanalista)
#### Post date: [September 5, 2018, 9:03am UTC](https://talk.jekyllrb.com/t/highlight-a-line-or-a-set-of-lines-on-a-code-snippet/2136/1 "2018-09-05T09:03:40Z")

</div>

I want to highlight a line or a set of lines on a code snippet.

When I used Jekyll 2.x with Redcarpet and Pygments, I added this to my website:

[https://zpao.com/posts/adding-line-highlights-to-markdown-code-fences/](https://zpao.com/posts/adding-line-highlights-to-markdown-code-fences/)

Now, I’m trying to use Jekyll 3.x with its defaults (Kramdown and Rouge).

I want something like the `hl_lines` setting described here:

> **[Syntax Highlighting](https://gohugo.io/content-management/syntax-highlighting/)**
>
> Hugo comes with really fast syntax highlighting from Chroma.

How can I achieve that in Jekyll 3.x?

---

<div class="post-metadata">

### Author: ![vinyanalista](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/vinyanalista/32/1212_2.png) [@vinyanalista](https://talk.jekyllrb.com/u/vinyanalista)
#### Post date: [September 5, 2018, 9:11am UTC](https://talk.jekyllrb.com/t/highlight-a-line-or-a-set-of-lines-on-a-code-snippet/2136/2 "2018-09-05T09:11:15Z")

</div>

For instance, when we share code from GitHub, we can do that:

> **[Sharing Line Highlights in GitHub Files](https://blog.mariusschulz.com/2015/07/25/sharing-line-highlights-in-github-files)**
>
> When you share a highlighted range of lines in a GitHub file, those line numbers might be incorrect once the file changes. Here's how to obtain a permalink to the file blob.

---

<div class="post-metadata">

### Author: ![mmistakes](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/mmistakes/32/2169_2.png) [@mmistakes](https://talk.jekyllrb.com/u/mmistakes)
#### Post date: [September 5, 2018, 7:39pm UTC](https://talk.jekyllrb.com/t/highlight-a-line-or-a-set-of-lines-on-a-code-snippet/2136/3 "2018-09-05T19:39:34Z")

</div>

Don’t think it’s possible yet. Not sure if Jekyll core needs to build in support for it or if Rouge (what Jekyll uses for syntax highlighting) needs it.

> <https://github.com/jneen/rouge/issues/342>
