Align your markdown table
- Deno
- Git (for local binary compilation)
- Bash, or Zsh, or Fish, or any GNU/Linux shell (for usage with a binary)
deno run jsr:@aminnairi/markdown-table-align example.md
cat example.md | deno run jsr:@aminnairi/markdown-table-align
# Clone the repository
git clone https://github.com/aminnairi/markdown-table-align
# Change the current directory
cd markdown-table-align
# Compile the binary
deno compile --allow-read --output ~/.local/bin index.ts
# Run the compiled binary
markdown-table-align example.md
Where ~/.local/bin
is the folder containing your binaries.
cat example.md
| ID | Name | Category ID |
| 11092 | Gorilla Fist | 27 |
| 11212 | Plate 3 x 3 | 14 |
| 11209 | Tyre 21 x 9.9 | 29 |
| 11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27 |
markdown-table-align example.md
ID | Name | Category ID
----------- | -------------------------------- | -----------
11092 | Gorilla Fist | 27
11212 | Plate 3 x 3 | 14
11209 | Tyre 21 x 9.9 | 29
11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27
cat example.md
| ID | Name | Category ID |
| 11092 | Gorilla Fist | 27 |
| 11212 | Plate 3 x 3 | 14 |
| 11209 | Tyre 21 x 9.9 | 29 |
| 11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27 |
cat example.md | markdown-table-align
ID | Name | Category ID
----------- | -------------------------------- | -----------
11092 | Gorilla Fist | 27
11212 | Plate 3 x 3 | 14
11209 | Tyre 21 x 9.9 | 29
11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27
deno add jsr:@aminnairi/markdown-table-align
import { alignMarkdownTable } from "@aminnairi/markdow-table-align"
const separator = "|"
const content = `
| ID | Name | Category ID |
| 11092 | Gorilla Fist | 27 |
| 11212 | Plate 3 x 3 | 14 |
| 11209 | Tyre 21 x 9.9 | 29 |
| 11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27 |
`
const aligned = alignMarkdownTable(separator, content)
console.log(aligned)
ID | Name | Category ID
----------- | -------------------------------- | -----------
11092 | Gorilla Fist | 27
11212 | Plate 3 x 3 | 14
11209 | Tyre 21 x 9.9 | 29
11640pr0003 | ELECTRIC GUITAR SHAFT Ø3.2 NO. 3 | 27
See LICENSE
.
See CONTRIBUTING.md
.
See SECURITY.md
.
See issues
.