Skip to main content
<!--This README is auto-generated from `tests/README.md`. Do not edit this file directly.-->[![Build Status](https://travis-ci.org/ickc/pantable.svg?branch=master)](https://travis-ci.org/ickc/pantable)[![GitHub Releases](https://img.shields.io/github/tag/ickc/pantable.svg?label=github+release)](https://github.com/ickc/pantable/releases)[![PyPI version](https://img.shields.io/pypi/v/pantable.svg)](https://pypi.python.org/pypi/pantable/)[![Development Status](https://img.shields.io/pypi/status/pantable.svg)](https://pypi.python.org/pypi/pantable/)[![Python version](https://img.shields.io/pypi/pyversions/pantable.svg)](https://pypi.python.org/pypi/pantable/)[![Downloads](https://img.shields.io/pypi/dm/pantable.svg)](https://pypi.python.org/pypi/pantable/)![License](https://img.shields.io/pypi/l/pantable.svg)[![Coveralls](https://img.shields.io/coveralls/ickc/pantable.svg)](https://coveralls.io/github/ickc/pantable)[![Scrutinizer](https://img.shields.io/scrutinizer/g/ickc/pantable.svg)](https://scrutinizer-ci.com/g/ickc/pantable/)

- [CSV Tables in Markdown: Pandoc Filter for CSV Tables](#csv-tables-in-markdown-pandoc-filter-for-csv-tables)
- [Example](#example)
- [Install and Use](#install-and-use)
- [Syntax](#syntax)
- [Related Filters](#related-filters)

CSV Tables in Markdown: Pandoc Filter for CSV Tables
====================================================

This allows CSV tables, optionally containing markdown syntax (enabled by default), to be put in markdown as a fenced code blocks.

Example
=======

This won’t work on GitHub’s markdown rendering nor PyPI. See the README in [GitHub-pages](https://ickc.github.io/pantable). There’s a [LaTeX output](https://ickc.github.io/pantable/README.pdf) too.

```table
---
caption: '*Awesome* **Markdown** Table'
alignment: RC
table-width: 0.7
markdown: True
---
First row,defaulted to be header row,can be disabled
1,cell can contain **markdown**,"It can be aribrary block element:

- following standard markdown syntax
- like this"
2,"Any markdown syntax, e.g.",$$E = mc^2$$
```

becomes

``` table
---
caption: '*Awesome* **Markdown** Table'
alignment: RC
table-width: 0.7
markdown: True
---
First row,defaulted to be header row,can be disabled
1,cell can contain **markdown**,"It can be aribrary block element:

- following standard markdown syntax
- like this"
2,"Any markdown syntax, e.g.",$$E = mc^2$$
```

Install and Use
===============

Install:

``` bash
pip install -U pantable
```

Use:

``` bash
pandoc -F pantable -o README.html README.md
```

Syntax
======

Fenced code blocks is used, with a class `table`. See [Example](#example).

Optionally, YAML metadata block can be used within the fenced code block, following standard pandoc YAML metadata block syntax. 7 metadata keys are recognized:

- `caption`: the caption of the table. If omitted, no caption will be inserted. Default: disabled.

- `alignment`: a string of characters among `L,R,C,D`, case-insensitive, corresponds to Left-aligned, Right-aligned, Center-aligned, Default-aligned respectively. e.g. `LCRD` for a table with 4 columns. Default: `DDD...`

- `width`: a list of relative width corresponding to the width of each columns. e.g.

``` yaml
- width
- 0.1
- 0.2
- 0.3
- 0.4
```

Default: auto calculated from the length of each line in table cells.

- `table-width`: the relative width of the table (e.g. relative to `\linewidth`). default: 1.0

- `header`: If it has a header row or not. True/False/yes/NO are accepted, case-insensitive. default: True

- `markdown`: If CSV table cell contains markdown syntax or not. Same as above. Default: False

- `include`: the path to an CSV file, can be relative/absolute. If non-empty, override the CSV in the CodeBlock. default: None

When the metadata keys is invalid, the default will be used instead.

Related Filters
===============

The followings are pandoc filters written in Haskell that provide similar functionality. This filter is born after testing with theirs.

- [baig/pandoc-csv2table: A Pandoc filter that renders CSV as Pandoc Markdown Tables.](https://github.com/baig/pandoc-csv2table)
- [mb21/pandoc-placetable: Pandoc filter to include CSV data (from file or URL)](https://github.com/mb21/pandoc-placetable)
- [panflute/csv-tables.py at 1ddcaba019b26f41f8c4f6f66a8c6540a9c5f31a · sergiocorreia/panflute](https://github.com/sergiocorreia/panflute/blob/1ddcaba019b26f41f8c4f6f66a8c6540a9c5f31a/docs/source/csv-tables.py)

``` table
---
Caption: Comparison
include: docs/comparison.csv
...
```

Metadata

Release files for pantable 0.0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pantable 0.0.10
File Size Uploaded
pantable-0.0.10.tar.gz 6.7 kB Details

Release files / pantable-0.0.10.tar.gz

Download URL pantable-0.0.10.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2650fd91adf28db0edf79baa35cd499b4b8f4a0f42f2c78e30ffcb46cd12d2a9
BLAKE2b-256 checksum
How to use checksums
c58a2a5c2d40f08d61f2edd5239186eaba50aa808c9e190a5dd2f0eea49508ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.14.2

2 release files

0.14.1

2 release files

0.13.6

2 release files

0.13.5

2 release files

0.13.4

2 release files

0.13.3

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12

2 release files

0.11.1

3 release files

0.11

3 release files

0.10.4

3 release files

0.10.3

0.10.2

3 release files

0.10.1

3 release files

0.10

2 release files

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9

1 release file

0.8.1

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

0.0.12

1 release file

0.0.11

1 release file

This release

0.0.10 This release

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page