Jekyll + redcarpet line numbers

672 views Asked by At

I set up a Jekyll blog and I have the following config for syntax highlighting.

markdown: redcarpet
highlighter: pygments

This allows me to add syntax highlighting like this:

```javascript
function blah(){

}
```

Is there any way to keep this format but add line numbers?

1

There are 1 answers

4
David Jacquel On BEST ANSWER

Out of the box Jekyll code highlight :

{% highlight ruby linenos %}
def foo
  puts 'foo'
end
{% endhighlight %}

And no need to highlight with javascript. Just add pygments css.