Sphinx directives for CSV-powered tabular authoring.
Project description
sphinx-tabular
Instead of just modifying the final table output, sphinx-tabular builds real docutils table nodes (table/tgroup/row/entry) the same way docutils' own table directives do, and only overrides the HTML rendering of table cells (for colspan/rowspan/inline styling) — the rest of the output is generated by Sphinx's normal HTML writer.
While the table structure and merged cells will work in the LaTeX builder PDF output, the table formatting (colors, icons, bacgkround color, text color, and alignment) is HTML only.
Donations to help support this project...
Features
- Sphinx extension.
- Uses standard CSV files or native reStructuredText list-table syntax.
- Easily merge table cells with
<and^. - Support reStructuredText, rich reStructuredText list cells, and Markdown.
- Support for inline table data and external files.
- Optional sticky header support for one or more header rows.
- Provides a minimal set of spreadsheet formulas.
- Set table cell alignment and per-cell alignment in both horizontal and vertical directions.
- Set custom cell text and background colors.
- Custom status pill.
- Support for Font Awesome and Bootstrip icons if installed by your theme.
- Sortable rows by clicking on the header row.
- Searchable option.
Installation
pip install sphinx-tabular
conf.py
extensions = [
...,
"sphinx_tabular",
...,
]
Directives
rcsv-table
Use CSV rows with reStructuredText cell content. Data may be inline or loaded
from an external .rcsv file.
.. rcsv-table:: Title
:file: table.rcsv
mcsv-table
Use CSV rows with MyST Markdown cell content. Data may be inline or loaded from
an external .mcsv file.
.. mcsv-table:: Title
:file: table.mcsv
rlist-table
Use a uniform two-level reStructuredText bullet list. Each top-level item is a row, and each nested item is a cell. Rich reStructuredText nodes are preserved inside ordinary cells.
.. rlist-table:: Interface status
:header-rows: 1
:stub-columns: 1
* - Name
- Owner
- Status
* - Alpha
- **Able Team**
- =STATUS(Ready; green)
rlist-table is inline-only. Use .. include:: when the list should be kept
in another source file.
Merging Cells
In rcsv-table and mcsv-table, an unquoted < merges with the cell to its
left and an unquoted ^ merges with the cell above it.
.. rcsv-table:: Horizontal merge
Merged,<
Unmerged,Unmerged
.. rcsv-table:: Vertical merge
Merged,Unmerged
^,Unmerged
In rlist-table, a cell containing one plain-text < or ^ is a merge
marker. Use an inline literal such as `<` or `^` when the
character should be displayed instead.
.. rlist-table:: List merge
* - Merged
- <
* - Unmerged
- Unmerged
Options
Supported options include:
:align:Place anrlist-tableatleft,center, orright.:class:Additional classes to add to the table.:file:Path to the.rcsvor.mcsvfile. Not supported byrlist-table.:header-rows:Number of top rows to format as header rows. If:sticky-header:is set, these rows become sticky.:initial-sort:Apply independent page-load ordering using one-basedCOLUMN=TYPE[:reverse]criteria.:name:Assign an explicit target name to anrlist-table.:search:Add a search field with a row count to the table and enable searching.:sortable:Enable row sorting by clicking on the headers.:sort-types:Assign interactive sort types using one-basedCOLUMN=TYPEentries.:sticky-header:Make the header rows sticky when scrolling long tables.:sticky-offset:CSS offset for sticky headers, such as3.5rem.:strict:Treat ragged rows and malformed input as errors instead of warnings.:stub-columns:Mark leftmost columns as semantic stubs forrlist-table.:text-align:Horizontal alignment of text in the cells. Default isleft.:vertical-align:Vertical alignment of text in cells. Default ismiddle.:width:CSS width for the table, such as100%.:widths:A space-separated list of column widths.
Formatting
- Custom theming.
=ALIGN()horizontal/vertical cell value alignment.=BG()set the background cell color.=FG()set text color.=ICON()use a Font Awesome or Bootstrap icon, or a fallback.=STATUS()insert a colored status pill.
Spreadsheet
'interprest as literal text without evaluation.+,-,*,/arithmetic operations on cells.=C4cell references.=A4:B4cell ranges.=AVG()take the average.=CONCAT()concatenation of cell values.=COUNT()count number of numerical values.=IF()conditional evaluation.=MAX()find the maximum value.=MIN()find the minimum value.=ROUND()round the number to an int or the specified decimal places.=SUM()sum a set or range of values.
Project details
Release history Release notifications | RSS feed
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 sphinx_tabular-0.2.4.tar.gz.
File metadata
- Download URL: sphinx_tabular-0.2.4.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d19bc9faaab9a1e3ae98547c68361c82bee873897982ca08efb740a30eec9f4
|
|
| MD5 |
6324b7bcfed69de2ce6c3ca214d5f474
|
|
| BLAKE2b-256 |
66e37603a5f0a51ef36350d098a0b58fdeb01efd3b7df152bc3f1f1a4bb4b30f
|
Provenance
The following attestation bundles were made for sphinx_tabular-0.2.4.tar.gz:
Publisher:
publish.yml on deepthinker2001/sphinx-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_tabular-0.2.4.tar.gz -
Subject digest:
6d19bc9faaab9a1e3ae98547c68361c82bee873897982ca08efb740a30eec9f4 - Sigstore transparency entry: 2145922358
- Sigstore integration time:
-
Permalink:
deepthinker2001/sphinx-tabular@702d2dc3e626b3bc27f0a74f2a85e2b503140fd4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepthinker2001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@702d2dc3e626b3bc27f0a74f2a85e2b503140fd4 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file sphinx_tabular-0.2.4-py3-none-any.whl.
File metadata
- Download URL: sphinx_tabular-0.2.4-py3-none-any.whl
- Upload date:
- Size: 34.1 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 |
efcff98d5318db2f0b85ee351d52162a56eda52478f87a980968abc7c50a0ad8
|
|
| MD5 |
7d794e3e29339ca99456acde4af0851f
|
|
| BLAKE2b-256 |
e896587480ecb246455de31edd326668a55361affee9803c91a21094dc2e7595
|
Provenance
The following attestation bundles were made for sphinx_tabular-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on deepthinker2001/sphinx-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_tabular-0.2.4-py3-none-any.whl -
Subject digest:
efcff98d5318db2f0b85ee351d52162a56eda52478f87a980968abc7c50a0ad8 - Sigstore transparency entry: 2145922376
- Sigstore integration time:
-
Permalink:
deepthinker2001/sphinx-tabular@702d2dc3e626b3bc27f0a74f2a85e2b503140fd4 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/deepthinker2001
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@702d2dc3e626b3bc27f0a74f2a85e2b503140fd4 -
Trigger Event:
workflow_dispatch
-
Statement type: