Enable line numbers globally

I’m trying to enable line numbers in code blocks globally, but so far I haven’t found a setting in _config.yml that works. According to this GitHub issue, I’ve tried:

highlighter: rouge

linenos: true

highlight:
  linenos: true

highlight_options:
  linenos: true

kramdown:
  input:          GFM
  # https://github.com/jekyll/jekyll/pull/4090
  syntax_highlighter: rouge

  syntax_highlighter_opts:
    css_class: 'highlight'
    span:
      line_numbers: false
    block:
      line_numbers: true
      start_line: 1

But none of these options has the desired effect. Any ideas what could be the issue here?

Have you tried using Javascript?

I’m not sure I understand what you mean. Do you mean code blocks with JavaScript highlighting? I only tried Python blocks so far, and when I use liquid tags it works (but not with triple-backticked blocks).

See the comment I just added to the GitHub issue you mentioned.

For me, that worked:

kramdown:
    syntax_highlighter_opts:
        block:
            line_numbers: true

I found that here: