https://github.com/gdiasag/jekyll-database-tables
Database-styled markdown tables for Jekyll
https://github.com/gdiasag/jekyll-database-tables
jekyll-plugin nix-flakes ruby
Last synced: 17 days ago
JSON representation
Database-styled markdown tables for Jekyll
- Host: GitHub
- URL: https://github.com/gdiasag/jekyll-database-tables
- Owner: gdiasag
- License: mit
- Created: 2026-06-10T20:38:17.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2026-06-15T15:28:54.000Z (24 days ago)
- Last Synced: 2026-06-15T17:08:10.247Z (24 days ago)
- Topics: jekyll-plugin, nix-flakes, ruby
- Language: Ruby
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jekyll-database-tables
Render Markdown pipe tables as databse-styled terminal output inside `
` blocks for [Jekyll](https://jekyllrb.com/).
## Installation
Install via RubyGems:
``` bash
gem install jekyll-database-tables
```
Or add it to your `Gemfile`:
``` ruby
gem 'jekyll-database-tables'
```
Then enable the plugin in `_config.yml`:
``` yaml
plugins:
- jekyll-database-tables
```
## Usage
Write a standard GFM pipe table in any page or document:
``` markdown
| Name | Age |
|-------|-----|
| Alice | 30 |
| Bob | 25 |
```
The plugin replaces it with a `
` block during the build:
``` html
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`:
``` yaml
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)).
## Development
### Nix
``` bash
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+.
``` bash
git clone https://github.com/gdiasag/jekyll-database-tables
cd jekyll-database-tables
bundle install
bundle exec rake test
```
[Ruby]: https://www.ruby-lang.org/en
[Bundler]: https://bundler.io
### 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`:
``` ruby
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`:
``` yaml
jekyll_database_tables:
formatter: custom
```