Pelican plugin to display data tables via a {% table %} shortcode.
Project description
pelican-tabular
Pelican plugin to embed data tables in Markdown articles via a {% table %} shortcode.
Installation
uv add pelican-tabular
Add to pelicanconf.py:
PLUGINS = ["pelican.plugins.tabular"]
Usage
{% table data/books.yaml %}
{% table data/books.yaml fields="title,rating,year" %}
{% table data/books.yaml sort_by="rating" sort_order="desc" %}
{% table data/books.yaml hidden="internal_id" %}
{% table data/books.yaml group_by="genre" group_summary_at="genre" %}
{% table data/books.yaml group_by="author,year" aggregate="year:year" field_labels="year=Publication Year" %}
Shortcode parameters
| Parameter | Description |
|---|---|
| (first positional) | Path to data file, relative to TABULAR_DATA_ROOT |
fields |
Comma-separated list of fields to display (overrides TABULAR_FIELDS) |
hidden |
Comma-separated list of fields to exclude from output |
sort_by |
Field key to sort rows by |
sort_order |
asc (default) or desc |
group_by |
Comma-separated fields to group rows by |
group_summary_at |
Fields at which to render a collapsible group-header row with row count; must be a prefix of group_by |
aggregate |
Comma-separated field:op pairs for collapsed groups (currently supports year) |
field_labels |
Per-shortcode label overrides, formatted as field=Label,field2=Label 2 |
Data formats
Supports YAML (list of dicts), JSON arrays, and CSV.
# data/books.yaml
- title: The Left Hand of Darkness
author: Ursula K. Le Guin
year: 1969
rating: 5
- title: Piranesi
author: Susanna Clarke
year: 2020
rating: 5
Cell value types
| Type | Example | Rendered as |
|---|---|---|
| Scalar | "Ursula K. Le Guin" |
Plain text |
| Date | 2020-01-15 |
ISO string |
| Link dict | {href: "https://…", text: "Homepage"} |
<a href="…">Homepage</a> |
| List | ["tag1", "tag2"] |
Unordered list |
Link dicts also accept url as an alias for href, and label as an alias for text.
{filename} links
Link href values support Pelican's {filename} syntax to cross-reference other articles:
- title: My Post
link: {href: "{filename}posts/my-post.md", text: "Read more"}
Settings
| Setting | Default | Description |
|---|---|---|
TABULAR_SHORTCODE |
"table" |
Shortcode name |
TABULAR_DATA_ROOT |
(Pelican PATH) |
Root directory for data files; absolute or relative to pelicanconf.py |
TABULAR_FIELDS |
[] |
Default field list (empty = auto-detect from data) |
TABULAR_FIELD_LABELS |
{} |
Global map of field key → display label |
TABULAR_COUNT_TEMPLATE |
"{n} rows" |
Row-count string below the table; {n} is replaced with the count |
TABULAR_GROUP_COUNT_TEMPLATE |
"{n} rows" |
Count string inside group-header rows |
TABULAR_COUNT_TEMPLATE and TABULAR_GROUP_COUNT_TEMPLATE have built-in defaults for zh ({n} 筆資料 / {n} 筆) and ja ({n} 件), derived from Pelican's DEFAULT_LANG setting.
Grouping
group_by reorders rows so that rows sharing the same key values are contiguous. group_summary_at adds a collapsible header row above each group that shows the group value and a row count.
{% table data/books.yaml group_by="genre,author" group_summary_at="genre" %}
This renders a genre-level header row for each genre, with all books listed beneath it. The header is collapsible via the bundled osm-map.js JS.
Aggregation
When aggregate is set, rows sharing a group_by key are collapsed into a single row. Currently supported operations:
| Op | Description |
|---|---|
year |
Collect all unique years from the field across grouped rows, sorted ascending, joined with , |
{% table data/books.yaml group_by="author" aggregate="year:year" %}
Column anchors
Every <th> element has an id attribute derived from the column label (e.g., id="osm-col--title"). These can be used as fragment links within the page. IDs are unique within a table; duplicate slugs get a numeric suffix (-2, -3, …).
CSS / JS
The generated HTML uses the same class names as pelican-osm (osm-place-list, osm-group-*) so the two plugins share CSS and the osm-map.js interactive sorting and group-toggle behaviour.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pelican_tabular-0.3.1.tar.gz.
File metadata
- Download URL: pelican_tabular-0.3.1.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35772eea745fa0f86409491b9671e62f5826a713669158317af32036091a6174
|
|
| MD5 |
840b70e049c2d895944d5b41a6187f65
|
|
| BLAKE2b-256 |
9c03859e001a1b0ce1753ae21275ed530d372f61aa47b21ee472ebf597af0582
|
Provenance
The following attestation bundles were made for pelican_tabular-0.3.1.tar.gz:
Publisher:
publish-to-pypi.yaml on Lee-W/pelican-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pelican_tabular-0.3.1.tar.gz -
Subject digest:
35772eea745fa0f86409491b9671e62f5826a713669158317af32036091a6174 - Sigstore transparency entry: 1669355821
- Sigstore integration time:
-
Permalink:
Lee-W/pelican-tabular@3b1f3601ba09f6d7beffa554a7005e47f5a2477e -
Branch / Tag:
refs/tags/0.3.1 - Owner: https://github.com/Lee-W
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@3b1f3601ba09f6d7beffa554a7005e47f5a2477e -
Trigger Event:
push
-
Statement type:
File details
Details for the file pelican_tabular-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pelican_tabular-0.3.1-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19faa2257281bb133f723a5896cec6b5bd43c0f3de7adb61c13b2191ddfbd423
|
|
| MD5 |
e0f5268e93695a8ad6479489bdf504a1
|
|
| BLAKE2b-256 |
c8751ef507b09b72d806c12a2c1445e9136b60d8e3cbc3f7fe62b72ea0a34b2e
|
Provenance
The following attestation bundles were made for pelican_tabular-0.3.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yaml on Lee-W/pelican-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pelican_tabular-0.3.1-py3-none-any.whl -
Subject digest:
19faa2257281bb133f723a5896cec6b5bd43c0f3de7adb61c13b2191ddfbd423 - Sigstore transparency entry: 1669355947
- Sigstore integration time:
-
Permalink:
Lee-W/pelican-tabular@3b1f3601ba09f6d7beffa554a7005e47f5a2477e -
Branch / Tag:
refs/tags/0.3.1 - Owner: https://github.com/Lee-W
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yaml@3b1f3601ba09f6d7beffa554a7005e47f5a2477e -
Trigger Event:
push
-
Statement type: