How can I change the default tab size in highlighted code in Jekyll 3.0?
Asked Answered
L

1

6

If I did:

{% highlight C %}
    .... code
{% endhighlight %}

For any tab I use between the highlighted C, I'd like the tab size to be 2 rather than 4. Doing {% highlight C tabsize=2 %} doesn't seem to work in Jekyll 3.

The answers I have seen on SO seem to work for older versions, but not recent versions.

Latoria answered 22/4, 2017 at 23:38 Comment(1)
By "older" you appear to mean the pygments code formatter and it's option, that is not around in the now default „rouge“ highlighter.Rosemare
R
9

I don't believe it's possible from Jekyll itself, but you can accomplish this with CSS using the tab-size attribute:

pre {
    tab-size: 2;
}
Relinquish answered 23/4, 2017 at 23:1 Comment(2)
Strangely, it's said to not work on IE... (can't verify right now, but also confirmed on SO)Rosemare
You saved my day!Amethyst

© 2022 - 2024 — McMap. All rights reserved.