首页 文章

Github页面无法正确显示降价

提问于
浏览
2

我正在使用github pages jekyll来 Build 我的博客 .

它在推送我的最新提交之前正常工作 . 此提交添加了一个cname文件,只是编辑了一些单词而没有对我的站点的体系结构进行任何更改 .

-    <h3 class="description">aaaaaaaaaa</h3>
+    <h3 class="description">bbbbbbbbbb</h3>

降价后没有正常显示 .

当我写#head1 . 它没有出现 Headers head1,它只是直接出现#head1 .

enter image description here

但是,如果我在localhost:4000中使用jekyll serve build,它会正确显示 .

enter image description here

这是我的_config.yml:

markdown:kramdown markdown_ext:markdown,mkd,mkdn,md textile_ext:textile highlighter:pygments

是什么导致了这个错误?

3 回答

  • 2

    更新!

    这很可能是由于Jekyll 3 upgradeGitHub Pages上 .

    从2016年5月1日起,GitHub将不再支持 rdiscountredcarpet . 此外,自2月1日起,GitHub Pages仅支持 rouge

    从2016年5月1日开始,GitHub Pages将仅支持kramdown,Jekyll的默认Markdown引擎 . GitHub Pages现在只支持Rouge .

    你可以看看here .

    为了处理它,请按以下步骤操作:

    首先,尝试按照answer解释 . 而不是 #Heading ,你会写 # Heading .

    其次,调整 _config.yml :更改 highlightermarkdown

    highlighter: rouge
    markdown: kramdown
    kramdown:
      input: GFM
    

    第三,要在本地构建您的站点,请使用Bundler,方法recommended by GitHub

    • 安装Bundler:
    gem install bundler
    
    • 然后运行 bundle update - 这将更新您的所有宝石,包括github-pages,如果您已在本地安装此gem .

    • 然后,使用以下内容创建 Gemfile (不带任何文件扩展名)

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

    将其保存到项目的根目录中 .

    • 然后,在项目上运行 bundle install . 这将创建一个名为 Gemfile.lock 的文件,并将 install all required gems and their dependencies .

    • 最后,运行 bundle exec jekyll serve --watch ,你'll be able to view your website locally exactly as you' ll在线查看(在GitHub上托管时) .

    那时你应该没问题!


    PS . 如果你的项目需要更多的宝石,如 jekyll-paginatejekyll-mentions ,你需要将它们添加到 Gemfile ,例如:

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

    另外,将它们添加到项目的 _config.yml

    gems:
      - jekyll-paginate
      - jekyll-mentions
    

    在这里,您将看到gem versions currently supported by GitHub Pages的列表 . 在这里你读到Upgrading Jekyll 2 to 3 .

    希望有所帮助!

  • 0

    运行我自己的Jekyll驱动的github页面博客,

    #表示 Headers 大小和 Headers 文本之间的空格很重要,否则标记将不会按预期显示 . 因此,举个例子,我会将我的降价 Headers 显示为,

    # Zookeeper Atomic Broadcast for heading 1
    
    ## Zookeeper Atomic Broadcast for heading 2
    
    ### Zookeeper Atomic Broadcast for heading 3
    
    #### Zookeeper Atomic Broadcast for heading 4
    
    ##### Zookeeper Atomic Broadcast for heading 5
    
  • 1

    GitHub支持markdown以及jekyll .
    首先使用 .md 扩展名重命名文件

    如果您的文件夹中有 .nojekyll ,它将 disable njekyll .

    确认您没有这是您的文件夹 .


    阅读docs && GitHub relevant doc了解如何准备和部署


    运行Jekyll使用命令git checkout切换到GitHub Pages构建服务器用于生成站点的默认分支 . 您切换到的默认分支取决于您正在构建的GitHub页面站点的类型 . 对于Project Pages站点,请切换到gh-pages . 对于用户页面或组织页面站点,切换到主站点 . 有关更多信息,请参阅“用户,组织和项目页面” . 使用命令bundle exec jekyll serve在存储库的根目录中运行带有Bundler的GitHub Pages构建服务器 . bundle exec jekyll serve导航到http:// localhost:4000以查看您的本地站点 .

相关问题