ftb

Crates.ioftb
lib.rsftb
version0.1.0
created_at2025-10-28 11:15:09.727038+00
updated_at2025-10-28 11:15:09.727038+00
descriptionA fast CLI tool to format and align Markdown tables
homepage
repositoryhttps://github.com/acamino/ftb
max_upload_size
id1904579
size51,753
Agustin Camino (acamino)

documentation

README

ftb

CI

A simple CLI tool to format and align Markdown tables.

This is a Rust port of the JavaScript formatter from markdowntable.com.

Installation

From crates.io

cargo install ftb

This installs the ftb binary.

From source

git clone https://github.com/acamino/ftb
cd ftb
cargo install --path .

Usage

Pipe a Markdown table through ftb to align its columns:

pbpaste | ftb

Or use with files:

cat table.md | ftb
ftb table.md
ftb table.md > formatted.md

Try it with the demo file:

ftb examples/demo.md

Examples

Basic Table

Input:

| h1 | h2 | h3 |
|-|-|-|
| data1 | data2 | data3 |

Output:

| h1    | h2    | h3    |
|-------|-------|-------|
| data1 | data2 | data3 |

Irregular Table

Input:

h1 | h2 | h3
-|-|-
data-1 | data-2 | data-3

Output:

| h1     | h2     | h3     |
|--------|--------|--------|
| data-1 | data-2 | data-3 |

Complex Table with Missing Cells

Input:

| Header 1 | Header 2 | Header 3 |
|----|---|-|
| data1a | Data is longer than header | 1 |
| d1b | add a cell|
|lorem|ipsum|3|

Output:

| Header 1 | Header 2                   | Header 3 |
|----------|----------------------------|----------|
| 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

cargo test

Building

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

cargo install --path .
# Now use: ftb

Option 2: Symlink to /usr/local/bin

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.

Commit count: 0

cargo fmt