https://github.com/aminnairi/markdown-table-align
Align your markdown table
https://github.com/aminnairi/markdown-table-align
align markdown table
Last synced: 10 months ago
JSON representation
Align your markdown table
- Host: GitHub
- URL: https://github.com/aminnairi/markdown-table-align
- Owner: aminnairi
- License: mit
- Created: 2024-11-30T17:22:26.000Z (over 1 year ago)
- Default Branch: development
- Last Pushed: 2024-12-01T08:26:08.000Z (over 1 year ago)
- Last Synced: 2025-07-25T08:53:32.645Z (11 months ago)
- Topics: align, markdown, table
- Language: TypeScript
- Homepage: https://jsr.io/@aminnairi/markdown-table-align
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# markdown-table-align
Align your markdown table
## Requirements
- [Deno](https://deno.com/)
- [Git](https://git-scm.com/) (for local binary compilation)
- [Bash](https://www.gnu.org/software/bash/), or [Zsh](https://www.zsh.org/), or [Fish](https://fishshell.com/), or any GNU/Linux shell (for usage with a binary)
## Installation
### With Deno
```bash
deno run jsr:@aminnairi/markdown-table-align example.md
cat example.md | deno run jsr:@aminnairi/markdown-table-align
```
### With compilation
```bash
# 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.
## Usage
### Command line interface
#### With argument
```bash
cat example.md
```
```text
| 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 |
```
```bash
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
```
#### With pipe
```bash
cat example.md
```
```text
| 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 |
```
```bash
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
```
## Library
```bash
deno add jsr:@aminnairi/markdown-table-align
```
```typescript
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
```
## License
See [`LICENSE`](./LICENSE).
## Contributing
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).
## Security Policy
See [`SECURITY.md`](./SECURITY.md).
## Issue
See [`issues`](./issues).