/jekyll-pandoc-plugin

Plugin for using Pandoc with Jekyll

Primary LanguageRubyMIT LicenseMIT

Jekyll Plugin for Using Pandoc-Ruby

This is a plugin for using pandoc as your markdown converter in jekyll.

A Note on Maintainership

This repo has passed between maintainers several times. I (@elliottslaughter) maintain the current version at this fork. Feel to submit issues and PRs.

Please join me in thanking all the previous maintainers for their work on this project!

Warnings for Existing Users

I (@elliottslaughter) have tested the current version of this repo with Jekyll 3.9.0 and Pandoc 2.11.3.2. The main caveat is that Pandoc in this version does not support the extension syntax that is currently supported by pandoc-ruby. However in practice I have found this is not an issue as long as you set your HTML to specify an encoding of UTF-8 (which enables the smart quotes to work). I don't personally have a need to enable any other extensions.

HTML5

After this recent commit the plugin uses pandoc's html5 output by default instead of html. This may break your existing CSS styling. See the Configuration section if you'd like to go back to using html output.

Installation

The plugin depends on the pandoc-ruby gem, which in turn depends on pandoc. You can install pandoc-ruby with:

gem install pandoc-ruby

To install this plugin, copy pandoc_markdown.rb into the _plugins directory in your site source root (if no _plugins directory exists, create it.)

Configuration

To tell jekyll to use pandoc to convert markdown, add the following line to your _config.yml.

markdown: pandoc

This plugin supports two configuration options for pandoc. Specify them both in the pandoc section of your _config.yml.

  • format - the output format to use, e.g., html5 (default) and html.
  • extensions - A list or hash of pandoc extensions to enable.

If none of the extensions you're using take arguments, then extensions can be a list:

pandoc:
  format: html5
  extensions: [smart, mathjax]

If an extention takes options, make extensions a hash that maps each extension name to its argument.

pandoc:
  format: html
  extensions:
    - smart
    - csl: 'apa.csl'
    - bibliography: 'references.bib'

Github Pages

The plugin will not work with github pages. If you set markdown: pandoc in your _config.yml, github pages will ignore this setting, and the default markdown converter will be used.

I use github pages to mirror my official site. My official site is built by jekyll using pandoc. I want my github mirror to be built using rdiscount, and I don't want to maintain two separate _config.yml files. My _config.yml file contains lines that look like this:

markdown:  rdiscount
pandoc:
   extensions: [smart, mathjax]

The plugin sees that the pandoc option has been set, and so uses pandoc. Github pages ignores the pandoc option, and sees that markdown has been set to rdiscount. To get the same effect, but without passing any options to pandoc, try

markdown:  rdiscount
pandoc:  true