1

I am trying to add a code snippet on blog post I am making using Github Pages & this what it looks like.


enter image description here


A double-framed horror occupying a huge amount of space for just a few lines of code.

I have tried different kinds of markdown

  1. <pre><code> block

  2. 4 spaces

  3. triple backtick

I am unable to get it to render any better.

I am using the default styles etc forked from jekylnow.

Are there any tricks I am missing?

UPDATE:

Markdown

Hello

function try(no) 
{
    while (no)
    {
        ...
        ....
    }
    return no;  
}

Hello


function try(no) 
{
    while (no)
    {
        ...
        ....
    }
    return no;  
}

Hello


function try(no) 
{
    while (no)
    {
        ...
        ....
    }
    return no;  
}

user93353
  • 13,733
  • 8
  • 60
  • 122

1 Answers1

1

As described by @lukehod in this answer...

In the _sass/_highlights.scss file you simply need to replace .highlight with pre.highlight. It appears that some styling can be applied twice if this is not specified. I also had a entry in pre.highlight{...} that I changed from overflow: scroll; to overflow: auto; in order to hide the scroll bars if they are not necessary.

BEFORE:

.highlight{
    ...
    overflow: scroll;
    ...
} 

AFTER:

pre.highlight{
    ...
    overflow: auto;
    ...
} 

It appears the original issue was with some Jekyll templates that people are running into still. I found the answer from this SO answer which referenced this thread if anyone wants more info.

HairOfTheDog
  • 2,489
  • 2
  • 29
  • 35