markdownjekyllgithub-pagessyntaxhighlighter

jekyll syntax highlighter not working


I'm using jekyll and Github Pages to build my website. And I followed all the instructions on http://jekyllrb.com/docs/templates/#code-snippet-highlighting, however, the syntax highlighter within my post won't render. Below is the code:

{% highlight ruby %}
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}

And I think the markdown file doesn't render properly, either. Can anyone tell me where I did wrong? You can check the post here: https://amir0320.github.io/blog/welcome-to-jekyll/


Solution

  • This is happening because you have a stale file called main.css inside the css folder of your Jekyll project, which is replacing the file generated by Jekyll from the SASS file.

    i.e. Jekyll builds the css\main.scss and creates a file _site\css\main.css, but then it sees the file css\main.css and copies it to _site\css\main.css, replacing the initial file that was generated via SASS.

    Solution: Delete this file css\main.css.