#formatter #cli #md #mtf

bin+lib mtf

Markdown Table Formatter

2 unstable releases

Uses new Rust 2024

new 0.2.0 Apr 26, 2025
0.1.0 Apr 26, 2025

#124 in Value formatting

34 downloads per month

MIT license

8KB
140 lines

Markdown Table Formatter

CLI

$ cat table.md
w | x | y | z
---|:---|---:|:---:
1 | 1 | 1 | 1
2 | 4 | 16 | 256
3 | 9 | 81 | 6561
4 | 16 | 256 | 65536

$ mtf table.md
| w  | x  |   y |   z   |
|----|:---|----:|:-----:|
| 1  | 1  |   1 |   1   |
| 2  | 4  |  16 |  256  |
| 3  | 9  |  81 | 6561  |
| 4  | 16 | 256 | 65536 |

Library

let input = "\
w | x | y | z
---|:---|---:|:---:
1 | 1 | 1 | 1
2 | 4 | 16 | 256
3 | 9 | 81 | 6561
4 | 16 | 256 | 65536

";

let output = "\
| w  | x  |   y |   z   |
|----|:---|----:|:-----:|
| 1  | 1  |   1 |   1   |
| 2  | 4  |  16 |  256  |
| 3  | 9  |  81 | 6561  |
| 4  | 16 | 256 | 65536 |

";

assert_eq!(mtf::process(input).unwrap(), output);

Dependencies

~5–15MB
~205K SLoC