【发布时间】:2023-03-13 22:05:02
【问题描述】:
我正在尝试创建一个简单的 Jekyll 转换器插件,它几乎是 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 新手。)
【问题讨论】:
-
PS,我已经尝试过这个 SO 答案中的建议(将我预处理的
content字符串输入到默认的 Markdown 转换器中),但无济于事。 stackoverflow.com/questions/22761691/…
标签: ruby plugins converter jekyll