Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Enabling line numbers adds too much space before codes #67

Closed
geeknerd opened this issue Oct 18, 2017 · 1 comment
Closed

Enabling line numbers adds too much space before codes #67

geeknerd opened this issue Oct 18, 2017 · 1 comment

Comments

@geeknerd
Copy link

Line numbers with Rouge has been giving me headaches for a long time and I tried to enable line numbers on this theme, deployed locally, it still gives too much space between the number and the codes. Also the alignment is just way off each other. Looks like Jekyll treats line number and codes as a two column table but I couldn't find a proper way to resize the column in the css file. Anyone has any idea?
To enable the line numbers I edited the _config.yml file

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

  # Rouge Highlighter in Kramdown › http://kramdown.gettalong.org/syntax_highlighter/rouge.html
  # span, block element options fall back to global
  syntax_highlighter_opts:
    # Rouge Options › https://github.com/jneen/rouge#full-options
    css_class: 'highlight'
    #line_numbers: true # bad idea, spans don't need linenos and would inherit this option
    span:
      line_numbers: false
    block:
      line_numbers: true
      start_line: 1

And the result looks like this:
Syntax Highlighting with line numbers

@geeknerd
Copy link
Author

I think I found a work-around for this issue. Just need to modify the syntaxhighliting scss file a little bit.
Solution

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant