# Enable line numbers globally

**URL:** <https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071>\
**Category:** Help\
**Created:** [October 13, 2017, 9:24am UTC](https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071 "2017-10-13T09:24:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbrnr](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@cbrnr](https://talk.jekyllrb.com/u/cbrnr)\
**Post date:** [October 13, 2017, 9:24am UTC](https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071/1 "2017-10-13T09:24:18Z")

</div>

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](https://github.com/jekyll/jekyll/issues/4619), I’ve tried:

```auto
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?

---

<div class="post-metadata">

**Author:** ![yashumittal](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/yashumittal/32/1260_2.png) [@yashumittal](https://talk.jekyllrb.com/u/yashumittal)\
**Post date:** [October 13, 2017, 9:52am UTC](https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071/2 "2017-10-13T09:52:09Z")

</div>

Have you tried using Javascript?

---

<div class="post-metadata">

**Author:** ![cbrnr](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@cbrnr](https://talk.jekyllrb.com/u/cbrnr)\
**Post date:** [October 13, 2017, 9:57am UTC](https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071/3 "2017-10-13T09:57:55Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![vinyanalista](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/vinyanalista/32/1212_2.png) [@vinyanalista](https://talk.jekyllrb.com/u/vinyanalista)\
**Post date:** [September 5, 2018, 12:21am UTC](https://talk.jekyllrb.com/t/enable-line-numbers-globally/1071/4 "2018-09-05T00:21:22Z")

</div>

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:

> <https://github.com/mmistakes/minimal-mistakes/issues/1437>
