Skip to content

DerekStride/jekyll-graphviz

Repository files navigation

Jekyll::Graphviz

CI Deploy to GitHub Pages Publish to rubygems

A GraphViz converter for Jekyll.

Installation

Add this line to your site's Gemfile:

group :jekyll_plugins do
  gem "jekyll-graphviz-dot"
end

And then add this line to your site's _config.yml:

plugins:
  - jekyll-graphviz

Usage

In your Jekyll site, create a GraphViz files that start with the following lines:

---
---

You need those three dashes in order for Jekyll to recognize it as "convertible". They won't be included in the content passed to the GraphViz parser.

Below is an example file that generate the following image:

---
---

digraph X {
  a -> b
}

foo

By default the images will be outputted as an svg to change to another compatible type use the graphviz.format option in your site's _config.yml.

graphviz:
  format: jpg

GraphViz

This plugin depends on ruby-graphviz which requires the GraphViz command line tool to be installed locally. You can find Installation Instructions Here.

Github Pages

To use this plugin with Github pages you'll need to use limjh16/jekyll-action-ts to setup a custom Github Pages deploy pipeline and install GraphViz with ts-graphviz/setup-graphviz. Check out this repo's Github Actions Workflow for an example.

There is an example jekyll site in the docs/ folder of this repo.

Development

After checking out the repo, run bundle install to install dependencies. Then, run rake test to run the tests.