jekyll-caption-tag

A Liquid tag for Jekyll sites that allows easy creation of captioned images like they are in WordPress.

How To Install

  1. Install all required gems: dimensions, rmagick (sudo gem install dimensions rmagick on Debian-based machines)

  2. Copy caption_tag.rb into <your-jekyll-site>/_plugins.

  3. Add the styles from style.css to your stylesheets.

  4. The thumbnails get created in <your-jekyll-site>/captions. Make sure that you don’t use this folder.

  5. After every site generation, move <your-jekyll-site>/captions to <your-jekyll-site>/_site/captions.

How To use

Place a caption tag in your content file, e.g.: {% caption align="aligncenter" width="512" height="233" alt="The order of points is important for the definition of a polygon" caption="[A, B, C, D, E, F, G] != [A, B, C, D, F, E, G]" url="../images/2013/11/polygon-order.png" %}

| Attribute | Details | | ————- |—————————————————————————-| | align | The content of this will be added to the class of the surrounding <div>. | | width | The width of the image. | | height | The width of the image. | | alt | The alternative attribute for images. | | caption | The text below the image. | | url | The source (src) of the image. |

Global configuration options

You can place the following options in your _config.yml file:

| Attribute | Default | Details | |——————–|————-|—————————————————————–| | caption_max_width | “512” | The maxiumum width captions may have when you don’t specify it. | | caption_max_height | “800” | The maximum height captions may have when you don’t specify it. | | caption_folder | “/captions” | The folder where captions get stored. |

Examples

Changelog

License

This code is licensed under MIT License.

What does this mean?

Documentation

I have a generated rdoc documentation.

It was generated with this command:

rdoc --exclude=/doc

TODO