Search code examples
jekyllscrollbarsrouge

Vertical Scroll bars in Jekyll Rouge


Is there anyway to add vertical scroll bars in Jekyll for really long code? I tried adding a Height attribute in _syntax.scss but with no luck. The syntax highlighter I'm using is rouge and the theme I'm using is here: https://github.com/mmistakes/hpstr-jekyll-theme


Solution

  • Yes, make sure you add this CSS to your theme:

    pre.highlight {
      max-height: 200px; /* Change to your desired max height */
      overflow-y: scroll;
    }
    

    Update. Using the OP URL provided here's what I did:

    Lookp where the class highlight is defined and add this to the end of its declaration:

    .highlight {
      [...]
      border: 1px solid #dbdbdb;
      background-color: #272822;
      border-radius: 3px;
    
    /** This part **/
      max-height: 300px;
      overflow-y: auto;
    }
    

    Results: After new CSS