Skip to main content

CSV Tables in Markdown: Pandoc Filter for CSV Tables

Project description

Date:
November 22, 2016

Build Status GitHub Releases PyPI version Development Status Python version License Coveralls Scrutinizer

CSV Tables in Markdown: Pandoc Filter for CSV Tables

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

Example

Also see the README in GitHub Pages. There’s a LaTeX output 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

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.

\begin{equation*} E = mc^2 \end{equation*}

Table: Awesome Markdown Table

(The equation might not work if you view this on PyPI.)

Install and Use

Install:

pip install -U pantable

Use:

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

Syntax

Fenced code blocks is used, with a class table. See 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.

    - 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.

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

pantable-0.2.2.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file pantable-0.2.2.tar.gz.

File metadata

  • Download URL: pantable-0.2.2.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pantable-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b478ade7bc097cd834451944d30b57b6648f29a47f77858510eab6453f81fafe
MD5 e57bf54da7ecca2ddaa2e459cfc31929
BLAKE2b-256 c4b82147194f63ee675d189db90a9fd2bc4d73e14c36d1ac674db4408aef7c32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page