Github pages cannot display markdown correctly

后端 未结 3 1248
挽巷
挽巷 2020-12-06 21:54

I am using github pages + jekyll to establish my blog.

It worked properly before pushed my latest commit. This commit adds a cname file and just edits some w

3条回答
  •  粉色の甜心
    2020-12-06 22:28

    UPDATED!

    This is most likely due to Jekyll 3 upgrade on GitHub Pages.

    From May 1st 2016 on, GitHub will not support rdiscount nor redcarpet anymore. Also, since February 1st, GitHub Pages only supports rouge:

    Starting May 1st, 2016, GitHub Pages will only support kramdown, Jekyll's default Markdown engine.

    GitHub Pages now only supports Rouge.

    You can check this out here.

    In order to deal with it, proceed as the following:

    First, try as explained on this answer. Instead of #Heading you'll write # Heading.

    Second, adjust your _config.yml: change highlighter and markdown for

    highlighter: rouge
    markdown: kramdown
    kramdown:
      input: GFM
    

    Third, to build your site locally, use Bundler, the method recommended by GitHub:

    1. Install Bundler:

      gem install bundler
      
    2. Then run bundle update - this will update all your gems, including github-pages, if you already have this gem installed locally.

    3. Then, create a Gemfile (leave it without any file extension) with the following content:

      source 'https://rubygems.org' 
      gem 'github-pages'
      

    Save it to your project's root.

    1. Then, run bundle install on your project. This will create a file called Gemfile.lock and will install all required gems and their dependencies.

    2. Finally, run bundle exec jekyll serve --watch and you'll be able to view your website locally exactly as you'll view online (when hosting on GitHub).

    You should be OK by then!


    PS. If your project needs more gems, as jekyll-paginate or jekyll-mentions, you'll need to add them to the Gemfile, for example:

    source 'https://rubygems.org' 
    gem 'github-pages'
    gem 'jekyll-paginate'
    

    Also, add them to your project's _config.yml:

    gems:
      - jekyll-paginate
      - jekyll-mentions
    

    Here you'll see a list of gem versions currently supported by GitHub Pages. Here you read about Upgrading Jekyll 2 to 3.

    Hope to have helped!

提交回复
热议问题