简单的 Jekyll 转换器插件不起作用

Simple Jekyll converter plugin not working

我正在尝试创建一个简单的 Jekyll Converter 插件,它几乎是 Converter Plugin in the Jekyll Documentation 的完整克隆,但它似乎不起作用:

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 新手。)

问题已解决。事实证明,上面的代码没有任何问题。

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

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