Last active
August 29, 2015 14:03
-
-
Save agoldst/37457e74c56b88c7c64d to your computer and use it in GitHub Desktop.
Jekyll 2 plugin for pandoc-ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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