Skip to content

Instantly share code, notes, and snippets.

@agoldst
Last active August 29, 2015 14:03
Show Gist options
  • Save agoldst/37457e74c56b88c7c64d to your computer and use it in GitHub Desktop.
Save agoldst/37457e74c56b88c7c64d to your computer and use it in GitHub Desktop.
Jekyll 2 plugin for pandoc-ruby
require 'jekyll'
require 'pandoc-ruby' # add pandoc-ruby to your Gemfile
# Plugin for using pandoc as Jekyll markdown processor
# http://jekyllrb.com/docs/extras/ q.v.
# install in jekyll _plugins/ folder
# or Octopress plugins/
# In _config.yml, specify
# markdown: Pandoc # capital P
# pandoc:
# flags: [ <array of flags> ]
# options:
# <hash of options>
class Jekyll::Converters::Markdown::Pandoc
def initialize(config)
@flags = config["pandoc"]["flags"]
@keyvals = config["pandoc"]["options"]
end
def convert(content)
# possibly :to => :html5 would be better?
PandocRuby.convert(content, {:from => :markdown, :to => :html},
*@flags,*@keyvals)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment