Expand description
§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 |
§Text Editor
- Use a text editor (Vim, Neovim, Helix Editor, …)
- Select Markdown table content in a file
(in Helix Editor type
␛xthenxrepeatedly, or type␛vthen hjkl or arrows) - Pass it as input to
mtf(in Helix Editor type|mtf⏎) mtfformats the table content
§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);Functions§
- process
- Process markdown content