csv to markdown table convertor.
Project description
# csv tables for Foliant
This preprocessor converts csv data to markdown tables.
## Installation
```shell
$ pip install foliantcontrib.csvtables
```
## Config
To enable the preprocessor with default options, add `csvtables` to `preprocessors` section in the project config:
```yaml
preprocessors:
- csvtables
```
The preprocessor has a number of options (default values stated below):
```yaml
preprocessors:
- csvtables:
delimiter: ';'
padding_symbol: ' '
paddings_number: 1
```
`delimiter`
: Delimiter of csv data.
`padding_symbol`
: Symbol combination that will be places around datum (reversed on the right side).
`paddings_number`
: Symbol combination multiplier.
## Usage
You can place csv data in `csvtable` tag.
```
<csvtable>
Header 1;Header 2;Header 3;Header 4;Header 5
Datum 1;Datum 2;Datum 3;Datum 4;Datum 5
Datum 6;Datum 7;Datum 8;Datum 9;Datum 10
</csvtable>
```
Or in external `file.csv`.
```
<csvtable src="table.csv"></csvtable>
```
You can reassign setting for certain csv tables.
```
<csvtable delimiter=":" padding_symbol=" *">
Header 1:Header 2:Header 3:Header 4:Header 5
Datum 1:Datum 2:Datum 3:Datum 4:Datum 5
Datum 6:Datum 7:Datum 8:Datum 9:Datum 10
</csvtable>
```
## Example
`Usage` section will be converted to this:
You can place csv data in `csvtable` tag.
```
| Header 1 | Header 2 | Header 3 | Header 4 | Header 5 |
|----------|----------|----------|----------|----------|
| Datum 1 | Datum 2 | Datum 3 | Datum 4 | Datum 5 |
| Datum 6 | Datum 7 | Datum 8 | Datum 9 | Datum 10 |
```
Or in external `file.csv`.
```
| Header 1 | Header 2 | Header 3 | Header 4 | Header 5 |
|----------|----------|----------|----------|----------|
| Datum 1 | Datum 2 | Datum 3 | Datum 4 | Datum 5 |
| Datum 6 | Datum 7 | Datum 8 | Datum 9 | Datum 10 |
```
You can reassign setting for certain csv tables.
```
| *Header 1* | *Header 2* | *Header 3* | *Header 4* | *Header 5* |
|------------|------------|------------|------------|------------|
| *Datum 1* | *Datum 2* | *Datum 3* | *Datum 4* | *Datum 5* |
| *Datum 6* | *Datum 7* | *Datum 8* | *Datum 9* | *Datum 10* |
```
This preprocessor converts csv data to markdown tables.
## Installation
```shell
$ pip install foliantcontrib.csvtables
```
## Config
To enable the preprocessor with default options, add `csvtables` to `preprocessors` section in the project config:
```yaml
preprocessors:
- csvtables
```
The preprocessor has a number of options (default values stated below):
```yaml
preprocessors:
- csvtables:
delimiter: ';'
padding_symbol: ' '
paddings_number: 1
```
`delimiter`
: Delimiter of csv data.
`padding_symbol`
: Symbol combination that will be places around datum (reversed on the right side).
`paddings_number`
: Symbol combination multiplier.
## Usage
You can place csv data in `csvtable` tag.
```
<csvtable>
Header 1;Header 2;Header 3;Header 4;Header 5
Datum 1;Datum 2;Datum 3;Datum 4;Datum 5
Datum 6;Datum 7;Datum 8;Datum 9;Datum 10
</csvtable>
```
Or in external `file.csv`.
```
<csvtable src="table.csv"></csvtable>
```
You can reassign setting for certain csv tables.
```
<csvtable delimiter=":" padding_symbol=" *">
Header 1:Header 2:Header 3:Header 4:Header 5
Datum 1:Datum 2:Datum 3:Datum 4:Datum 5
Datum 6:Datum 7:Datum 8:Datum 9:Datum 10
</csvtable>
```
## Example
`Usage` section will be converted to this:
You can place csv data in `csvtable` tag.
```
| Header 1 | Header 2 | Header 3 | Header 4 | Header 5 |
|----------|----------|----------|----------|----------|
| Datum 1 | Datum 2 | Datum 3 | Datum 4 | Datum 5 |
| Datum 6 | Datum 7 | Datum 8 | Datum 9 | Datum 10 |
```
Or in external `file.csv`.
```
| Header 1 | Header 2 | Header 3 | Header 4 | Header 5 |
|----------|----------|----------|----------|----------|
| Datum 1 | Datum 2 | Datum 3 | Datum 4 | Datum 5 |
| Datum 6 | Datum 7 | Datum 8 | Datum 9 | Datum 10 |
```
You can reassign setting for certain csv tables.
```
| *Header 1* | *Header 2* | *Header 3* | *Header 4* | *Header 5* |
|------------|------------|------------|------------|------------|
| *Datum 1* | *Datum 2* | *Datum 3* | *Datum 4* | *Datum 5* |
| *Datum 6* | *Datum 7* | *Datum 8* | *Datum 9* | *Datum 10* |
```
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
Close
Hashes for foliantcontrib.csvtables-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69420280c241f88690c483218b18334840e6cd2c96e881c5fed854be56533d9f |
|
MD5 | 87587e1bf23bdc8a7cc2af9c9136ccfc |
|
BLAKE2b-256 | 3b249a484f0ebb3d4b71df7f1ba150c06001c2c9c3b568543ec820b7bf03c180 |