The project is in a healthy, maintained state
A Jekyll plugin to render markdown tables as database-styled terminal outputs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 3.9, < 5.0
 Project Readme

jekyll-database-tables

Render Markdown pipe tables as databse-styled terminal output inside <pre> blocks for Jekyll.

Installation

Install via RubyGems:

gem install jekyll-database-tables

Or add it to your Gemfile:

gem 'jekyll-database-tables'

Then enable the plugin in _config.yml:

plugins:
  - jekyll-database-tables

Usage

Write a standard GFM pipe table in any page or document:

| Name  | Age |
|-------|-----|
| Alice | 30  |
| Bob   | 25  |

The plugin replaces it with a <pre class="[db]-table"> block during the build:

Name  | Age
------+----
Alice | 30
Bob   | 25

Content inside fenced code blocks is never processed, so example tables in documentation stay intact.

Configuration

All options go under the jekyll_database_tables key in _config.yml:

jekyll_database_tables:
  formatter: psql

Formatters

  • Default (psql): PostgreSQL-styled terminal output with space-padded columns separated by | and a -+- divider.

Custom formatters can also be provided (see Development).

Development

Nix

git clone https://github.com/gdiasag/jekyll-database-tables
cd jekyll-database-tables
nix develop
rake test

Starting a shell with the build environment provided in flake.nix provides you with Ruby, Bundler, and all gem dependencies pinned to exact versions from the lock file, so no bundle install needed. Gem executables (e.g. rake and rubocop) are on PATH directly.

Others

Requires Ruby v3.3+ and Bundler v2.7+.

git clone https://github.com/gdiasag/jekyll-database-tables
cd jekyll-database-tables
bundle install
bundle exec rake test

Writing a custom formatter

Create a subclass of Jekyll::DatabaseTables::Formatter implementing #render, #format_row, and #separator. Then register it in Jekyll::DatabaseTables::Converter#formatter_instance:

class CustomFormatter < Jekyll::DatabaseTables::Formatter
  include Formatter::Helpers

  def render(table, title: nil)
    # ...
  end

  def format_row(cells, widths)
    # ...
  end

  def separator(widths)
    # ...
  end
end

Users select it via _config.yml:

jekyll_database_tables:
  formatter: custom