简单的Jekyll转换器插件无法正常工作

时间:2017-07-27 11:43:49

标签: ruby plugins converter jekyll

我试图创建一个简单的Jekyll Converter插件,它几乎是https://github.com/skatejs/dom-diff的完整克隆,但它似乎不起作用:

module Jekyll
  class MyConverter < Converter
    safe false
    priority :high

    def matches(ext)
      ext =~ /^\.(md|markdown)$/i
    end

    def output_ext(ext)
      ".html"
    end

    def convert(content)
      content.upcase
    end
  end
end

我已将此文件my_converter.rb放入我的_plugins目录。

现在当我bundle exec jekyll serve时,我希望看到呈现给HTML的每个降价页面的内容都转换为大写。然而,似乎没有任何事情发生。

我错过了什么? (我是Ruby的新手,顺便说一句。)

1 个答案:

答案 0 :(得分:5)

问题解决了。事实证明,上述代码没有任何问题。

问题在于,在某些时候,github-pages gem已添加到我们的Gemfile中(不需要)。显然,使用github-pages插件Jekyll is always started in safe mode and the plugin_dir is a random string

从我们的Gemfile中删除github-pages gem修复了它!

相关问题