https://github.com/foliant-docs/foliantcontrib.csvtables
csv to markdown tables convertor for Foliant
https://github.com/foliant-docs/foliantcontrib.csvtables
Last synced: 5 months ago
JSON representation
csv to markdown tables convertor for Foliant
- Host: GitHub
- URL: https://github.com/foliant-docs/foliantcontrib.csvtables
- Owner: foliant-docs
- License: mit
- Created: 2019-02-15T09:17:07.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2021-07-22T09:19:53.000Z (almost 5 years ago)
- Last Synced: 2025-09-28T00:22:54.544Z (9 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pypi.org/project/foliantcontrib.csvtables/) [](https://github.com/foliant-docs/foliantcontrib.csvtables)
# CSVTables 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.
```
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`.
```
```
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
```
## 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* |
```