/jekyll-asciidoc

A Jekyll plugin to convert AsciiDoc files in your site source to HTML pages using Asciidoctor

Primary LanguageRubyMIT LicenseMIT

Jekyll AsciiDoc Plugin (powered by Asciidoctor)

A Jekyll plugin that converts AsciiDoc files in your site source to HTML pages using Asciidoctor.

The plugin consists of three extensions:

Jekyll::Converters::AsciiDocConverter

Converts AsciiDoc files to HTML

Jekyll::Generators::AsciiDocPreprocessor

Promotes select AsciiDoc attributes to Jekyll front matter (e.g., title, author, page-layout)

Jekyll::Filters.asciidocify

A Liquid filter for converting AsciiDoc content to HTML using the AsciiDocConverter

All these extensions are included in the file asciidoc_plugin.rb.

Installation

The plugin depends on the Asciidoctor gem, named asciidoctor. You can install the gem using:

$ gem install asciidoctor

If you are using Bundler to manage the dependencies in your Jekyll project, then add the Asciidoctor gem instead to your Gemfile (below the Jekyll gem, named jekyll):

source 'https://rubygems.org'
gem 'jekyll'
gem 'asciidoctor'

Then run the Bundler install command:

bundle install

To install this plugin, copy asciidoc_plugin.rb to the _plugins directory in the root of your site source.

Note
If no _plugins directory exists, you need to first create it.

Configuration (Optional)

By default, this plugin uses Asciidoctor to convert AsciiDoc files. Since Asciidoctor is the only option, the default setting is equivalent to the following configuration in _config.yml:

asciidoc: asciidoctor

To tell Jekyll which extensions to recognize as AsciiDoc files, add the following line to your _config.yml:

asciidoc_ext: asciidoc,adoc,ad

The extensions shown in the previous listing are the default values, so you don’t need to specify this option if those defaults are sufficient.

To pass additional attributes to AsciiDoc, or override the default attributes defined in the plugin, add the following lines to your _config.yml:

asciidoctor:
  attributes:
    - hardbreaks!
    - source-highlighter=coderay
    - coderay-css=style