jekyll-indent_filter

jekyll-indent_filter

Jekyll plugin to provide an indentation filter.

Jekyll Indentation Filter

This plugin provides a filter for indenting Liquid output.

Based on the example plugin described in Mike Fulcher’s blog post, "Better Indentation for Injected Jekyll Content", this plugin solves the <pre> and <code> tag caveat mentioned in the blog post and incorporates a few code style changes and optimizations.

Installation

This plugin is provided as a gem:

gem install jekyll-itafroma-indent_filter

Once the gem is installed, include it in your Jekyll site's configuration:

gems: ['jekyll/itafroma/indent_filter']

Usage

Specify the number of spaces you’d like the output to be by using the indent filter:

{{ content | indent: 20 }}
<!-- content will be indented 20 spaces -->

Acknowledgements

This plugin is inspired the example provided in Mike Fulcher’s blog post, "Better Indentation for Injected Jekyll Content".

The <pre> and <code> indentation solution was inspired by kerotaa's remove-empty-lines-html.rb plugin.

This plugin is copyright © 2013 Mark Trapp. All rights reserved. It is made available via the MIT license. A copy of the license can be found in the LICENSE file.