0

I am writing a blog using Jekyll 4.0 on Windows 10, and when I use the highlight tag, everything works perfectly, however, once i use the linenos parameter, the web breaks and looks like this:

enter image description here

If I inspect the html source, the code doesn't seem to appear anywhere in the document

This is the markdown I'm using

{% highlight c linenos %}

void main(void) {
    // initialize the device
    SYSTEM_Initialize();

    while (1) {
        // LOAD INPUTS TO SHIFT REGISTER
        SHIFT_REG_SH_NLD = 0;
        SHIFT_REG_CLK = 0;
        // SHIFT EACH INPUT ONE BY ONE
        for (uint8_t i = 0; i < 8; i++) {
            // CHECK IF ANY INPUT IS PRESSED
            uint8_t input = SHIFT_REG_INPUT;

            // IF PRESSED (PULLED TO LOW) SEND TO IR EMITTER
            if (input == LOW) {
                ir_emit(i);
            }
            // ENABLE SHIFTING
            SHIFT_REG_SH_NLD = 1;
            // MAKE SURE THE SHIFT IS ENABLED
            __delay_us(1);
            // RISE CLK
            SHIFT_REG_CLK = 1;
            // MAKE SURE THAT CLK STAYS LOW ENOUGH TIME
            __delay_us(1);
            SHIFT_REG_CLK = 0;
        }
    }
}

{% endhighlight %}

I'm using the ThinkSpace theme

Thanks a lot

Aleix Sanchis
  • 302
  • 3
  • 12

1 Answers1

0

This issue is coming directly from the ThinkSpace theme. By the looks of their Cheatsheet Demo post, they haven’t accounted for people using the highlight tag, with the lilenos parameter.

The vanishing issue seems to come from the compress layout file - ./_layouts/compress.html. This layout file is rewriting the compiled code and somehow removing the highlight tag content in the process. If you replace all of the code (except the front matter) in this template file with a {{ content }} tag, the highlight snippet will appear on the page (but with broken formatting).

I wouldn’t recommend compressing the html using a layout file. Personally I’ve used Gulp & gulp-htmlmin without issue and gives lots of control over the final output.

alxrb
  • 1,628
  • 2
  • 14
  • 13