# ftb

A simple CLI tool to format and align Markdown tables.
This is a Rust port of the JavaScript formatter from [markdowntable.com](http://markdowntable.com/).
## Installation
### From crates.io
```bash
cargo install ftb
```
This installs the `ftb` binary.
### From source
```bash
git clone https://github.com/acamino/ftb
cd ftb
cargo install --path .
```
## Usage
Pipe a Markdown table through `ftb` to align its columns:
```bash
Or use with files:
```bash
ftb table.md > formatted.md
```
Try it with the demo file:
```bash
ftb examples/demo.md
```
## Examples
### Basic Table
Input:
```
| data1 | data2 | data3 |
```
Output:
```
| data1 | data2 | data3 |
```
### Irregular Table
Input:
```
data-1 | data-2 | data-3
```
Output:
```
| data-1 | data-2 | data-3 |
```
### Complex Table with Missing Cells
Input:
```
| data1a | Data is longer than header | 1 |
| d1b | add a cell|
|lorem|ipsum|3|
```
Output:
```
| data1a | Data is longer than header | 1 |
| d1b | add a cell | |
| lorem | ipsum | 3 |
```
## Features
- Aligns columns based on content width
- Handles missing cells by adding empty columns
- Removes leading/trailing empty columns
- Works with irregular table formats
- Fast and lightweight
## Development
### Running Tests
```bash
cargo test
```
### Building
```bash
cargo build --release
```
The binary will be available at `target/release/ftb`.
### Local Development Setup
For ergonomic local testing, choose one of these options:
**Option 1: Install locally**
```bash
cargo install --path .
# Now use: ftb
```
**Option 2: Symlink to /usr/local/bin**
```bash
ln -s $(pwd)/target/release/ftb /usr/local/bin/ftb
# Now use: ftb anywhere
```
## License
MIT
## Credits
Port of the Markdown table formatter from [markdowntable.com](http://markdowntable.com/).