# How to highlight the specific lines of code snippet?

**URL:** https://talk.jekyllrb.com/t/how-to-highlight-the-specific-lines-of-code-snippet/6656
**Category:** Uncategorized
**Created:** [November 8, 2021, 6:42am UTC](https://talk.jekyllrb.com/t/how-to-highlight-the-specific-lines-of-code-snippet/6656 "2021-11-08T06:42:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Poovarasan](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Poovarasan](https://talk.jekyllrb.com/u/Poovarasan)
#### Post date: [November 8, 2021, 6:42am UTC](https://talk.jekyllrb.com/t/how-to-highlight-the-specific-lines-of-code-snippet/6656/1 "2021-11-08T06:42:43Z")

</div>

Currently we are converting the md files in to html files using Jekyll.

I would like to highlight the some of the code snippet lines like below.

![image](https://canada1.discourse-cdn.com/flex030/uploads/jekyllrb/original/2X/8/8b4d762fc956754776f4e21bb16857524dceac45.png)

Could you please help me achieve this ?

Am using **jekyll 4.2.1**

Thanks in advance.

Regards,  
Poovarasan K

---

<div class="post-metadata">

### Author: ![Poovarasan](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Poovarasan](https://talk.jekyllrb.com/u/Poovarasan)
#### Post date: [November 12, 2021, 6:02am UTC](https://talk.jekyllrb.com/t/how-to-highlight-the-specific-lines-of-code-snippet/6656/2 "2021-11-12T06:02:45Z")

</div>

Hi

Any update on this ?

Regards,  
Poovarasan K

---

<div class="post-metadata">

### Author: ![rdyar](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/rdyar/32/710_2.png) [@rdyar](https://talk.jekyllrb.com/u/rdyar)
#### Post date: [November 13, 2021, 3:14am UTC](https://talk.jekyllrb.com/t/how-to-highlight-the-specific-lines-of-code-snippet/6656/3 "2021-11-13T03:14:33Z")

</div>

not sure it can be done - jekyll uses rouge for highlighting and it didn’t used to support this, I see now that if does:

> <https://github.com/rouge-ruby/rouge/pull/1426>
>
> \- add line highlighting option to HTMLLinewise formatter
> \- add dedicated format…ter to add line highlighting (only marks highlighted lines)

but I don’t think jekyll supports the new option in rouge.

In rouge it is here:  
[GitHub - rouge-ruby/rouge: A pure Ruby code highlighter that is compatible with Pygments](https://github.com/rouge-ruby/rouge#formatters) – `Rouge::Formatters::HTMLLineHighlighter.new(formatter, highlight_lines: [3, 5])`
