I'm trying to add line numbers to fenced code blocks in markdown with Jekyll. Moreover, I am trying to find ways of updating the code CSS style.
Regarding the first question I am trying to follow the instructions in the following thread. Thus, I am trying to do two things, encapsulate the code using the following commands:
{% highlight python linenos %}
<code>
{% endhighlight %}
However, when I do this the code appears right after the line counter:
1
2
3
4
5
import os
import numpy as np
....
And the same behavior is occurring when I am changing in the config.yml the following lines to true:
# Markdown and syntax highlight
markdown: kramdown
highlighter: rouge
kramdown:
input: GFM
syntax_highlighter_opts:
css_class: 'highlight'
span:
line_numbers: false #true
block:
line_numbers: false #true
start_line: 1
How can I solve this issue? And in general, how can I change the CSS for only the code blocks?
EDIT:
The results after the inspection of the code:

Your question consists of two issues, let's tackle them one by one.
Adding line numbers
There are two basic different ways of adding code line numbers to code snippets.
which works for code blocks generated with triple backticks: ```.
If you need line numbers in each code snippet the second approach is more useful.
Styling
To apply a specific style for code snippets you can utilize
rougegem commands.rougegem locally withgem install rougecommand.Here you can find a list of supported themes, sometimes there is more than one in a single file (e. g. in
base16.rb)