Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/klntsky/simpletablegenerator
Pretty text table generator with multiline support!
https://github.com/klntsky/simpletablegenerator
Last synced: 5 days ago
JSON representation
Pretty text table generator with multiline support!
- Host: GitHub
- URL: https://github.com/klntsky/simpletablegenerator
- Owner: klntsky
- License: gpl-3.0
- Created: 2016-06-12T16:26:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-22T19:32:10.000Z (almost 8 years ago)
- Last Synced: 2024-11-09T15:47:42.528Z (2 months ago)
- Language: Haskell
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SimpleTableGenerator
## About
This library is for drawing text tables.
Pass a 2D-list of strings representing cells and get a single string with table contents.
```
makeDefaultSimpleTable :: [[String]] -> String
```Newlines are supported.
## Basic usage
```
putStrLn $ makeDefaultSimpleTable [["1","2","3"], ["One","Two","Three"], ["First", "Second"]]
```
```
┌───────┬────────┬───────┐
│ 1 │ 2 │ 3 │
├───────┼────────┼───────┤
│ One │ Two │ Three │
├───────┼────────┼───────┤
│ First │ Second │ │
└───────┴────────┴───────┘
```## Advanced usage
You can configure the table by constructing `SimpleTableConfig` and passing it to `makeSimpleTable`.
```
putStrLn $ makeSimpleTable simpleTableConfig {
tableBorders = "+++++++++-|",
colMinWidths = [3, 4],
rowMinHeights = [2],
padFunction = simpleTableLeftPad,
cellPadFunction = simpleTableBottomPad,
horizontalPadding = 0,
verticalPadding = 1,
paddingStr = ".,`"
} [["a"], ["b", "c"]]
```
```
+---+----+
|.,`|.,`.|
|.,a|.,`.|
|.,`|.,`.|
|.,`|.,`.|
+---+----+
|.,`|.,`.|
|.,b|.,`c|
|.,`|.,`.|
+---+----+
```Check out [the docs](https://hackage.haskell.org/package/SimpleTableGenerator-0.2.0.0/docs/Text-SimpleTableGenerator.html) for more info.