3
votes

I'm trying to create a simple Jekyll Converter Plugin which is almost a complete clone of the Converter Plugin in the Jekyll Documentation, but it doesn't seem to work:

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

I've placed this file my_converter.rb into my _plugins directory.

Now when I do bundle exec jekyll serve, I expect to see the content of every markdown page that is rendered to HTML converted to uppercase. However, nothing seems to happen.

What am I missing? (I'm a Ruby novice, btw.)

1
PS, I've tried the suggestion in this SO answer (feeding my preprocessed content String into the default Markdown converter), to no avail. stackoverflow.com/questions/22761691/…Heather Miller

1 Answers

6
votes

Problem solved. It turns out that there's nothing wrong with the above code.

The problem was that at some point, the github-pages gem had been added to our Gemfile (unneeded). Apparently, with the github-pages plugin, Jekyll is always started in safe mode and the plugin_dir is a random string.

Removing the github-pages gem from our Gemfile fixed it!