markdown - 如何在 GitHub Pages 中安装/使用 Jekyll 插件?

标签 markdown jekyll github-pages jekyll-extensions

我已经与 Jekyll 一起创建了一个 GitHubPage,目前我正在尝试使用一些可用的基本插件。到目前为止,没什么特别的,我正在使用白名单插件,特别是 this一。它会在新选项卡中打开链接,而 Markdown 默认情况下不支持此功能。

到目前为止,我已经使用 myusername.github.io 存储库创建了该网站,将其克隆到本地,并按原样使用 jekyll new 创建了一个基本网站指示here 。然后我将所有更改推送到 GitHub,一切正常。

然后,为了安装上述插件,我按照帮助部分中提到的步骤进行操作,即以下内容:


Add the following to your site's Gemfile

gem 'jekyll-target-blank'

and add the following to your site's _config.yml

plugins:
  - jekyll-target-blank

另请注意,默认情况下 Gemfile 包含以下部分,其中包含以下说明:

# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.8.3"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

因此,我按照指示更改了 Gemfile 并运行了bundle update github-pages

现在我的 Gemfile 完整如下:

source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 3.8.3"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
  gem 'jekyll-target-blank'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

请注意,我已注释/取消注释了适当的部分。

我的 _config.yml 看起来像这样:

title: xxxxxx
email: xxxxxx
description: >- # this means to ignore newlines until "baseurl:"
  xxxxxx.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com

github_username:  xxxxxx
instagram_username: xxxxxx

# Build settings
markdown: kramdown
theme: minima
plugins:
  - jekyll-feed
  - jekyll-target-blank

然后我做了

bundle exec jekyll serve

http://127.0.0.1:4000/本地运行它,插件工作正常。通过单击如下所示的链接,它会在新选项卡中打开该链接。

[LinkText](link)

但是,当我将其全部推送到 GitHub 时,该插件不起作用。它仍然在同一选项卡上打开链接。

我做错了什么?

最佳答案

我是 Jekyll Target Blank 的开发者。 GH Pages 仅支持部分插件 https://help.github.com/articles/adding-jekyll-plugins-to-a-github-pages-site/ 。我已请求支持此插件,但他们的回应是可能。

关于markdown - 如何在 GitHub Pages 中安装/使用 Jekyll 插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51977736/

相关文章:

formatting - 在使用四开本创建的引用书目中使用粗体字体格式化特定作者

yaml - Jekyll 中的液体嵌套 For-Loop 语法问题

ruby - 如何将 octopress 3 部署到现有 gh-pages 站点中的子目录?

github - 在 GitHub 中左键单击 PDF 应该在浏览器中显示它还是下载它?

ajax - 隐藏 Github 页面的 api key

git - 使用 GitHub Pages 时了解 Jekyll 和 gh-pages 分支

r - 编织器与 bash : change working directory

css - 适用于 Knitr-markdown 输出的 CSS 样式资源?

docker - 通过 Docker 设置 Jekyll?

jekyll - 隐藏GitHub服务的Jekyll网站中的页面