Pre-processing markup files in jekyll

I would like to write a preprocessor that works with different markup languages ​​before they are rendered in HTML by Jekyll. Ideally, the user would just create a file called _posts / xxyyzz.md.wmd and Jekyll will preprocess it on xxyyzz.md using the plugin I provide and then process it in HTML in the usual way.

It looks like the Jekyll Converter Framework doesn't allow this because output_ext

only the final "wmd" extension is provided to the function , preventing it from returning ".md" for ".md.wmd", ".textile" for ".textile.wmd", etc. .d.

Is there a way to implement a whole series of processing steps?

EDIT: grammar

+3


source to share


1 answer


Maybe you can try using the Generator plugin that your wmd converter uses:



require "yourWmdConverter"

module Jekyll
  class ConvertWmd < Jekyll::Generator

    def initialize(config)
      config['convert_wmd'] ||= true
    end

    def generate(site)
      @site = site
      site.posts.docs.each { |post| convertWmd post }
    end

    private

    def convertWmd(post) 
      post.content = yourWmdConverter post.content
    end

  end
end

      

+3


source







All Articles