Skip to content
Back to skills

Loom Md Tables

ASecurity

Fix markdown table alignment and spacing issues.

  • 56 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
ai-agentspythonbash

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add cosmix/loom --skill loom-md-tables --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Loom Md Tables?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Loom Md Tables
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cosmix-loom-md-tables/badge)](https://www.skillsdirectory.com/skills/cosmix-loom-md-tables)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: loom-md-tables
description: Fix markdown table alignment and spacing issues.
allowed-tools:
  - Read
  - Edit
  - Bash(python *)
triggers:
  - markdown table
  - md table
  - table formatting
  - column alignment
  - pipe table
  - GFM table
  - table generator
  - align columns
  - table spacing
  - table layout
  - fix table
  - format table
  - table structure
---

# Markdown Table Formatting

Utility for fixing markdown table alignment and spacing. Normalizes column widths, ensures consistent padding, and preserves alignment markers.

## Quick Examples

```bash
# Preview fixed output
python fix-md-tables.py document.md

# Fix in-place
python fix-md-tables.py document.md -i
```

### Common Patterns

**Status tables:**

```markdown
| Stage | Status    | Branch     |
| ----- | --------- | ---------- |
| build | Complete  | loom/build |
| test  | Executing | loom/test  |
```

**Configuration tables:**

```markdown
| Option     | Default | Description           |
| ---------- | ------- | --------------------- |
| timeout    | 300     | Session timeout (sec) |
| auto_merge | false   | Enable auto merging   |
```

**Right-aligned numbers** (script preserves the `---:` marker but left-aligns and right-pads the cell *text* — GFM still renders these right-aligned when displayed):

```markdown
| Item  | Count | Total |
| ----- | ----: | ----: |
| Files | 42    | 500   |
| Lines | 1,234 | 5,000 |
```

## Features

- Aligns each column to its widest cell (separators get a minimum width of 3)
- Single-space padding; cell **content is always left-aligned and right-padded** (`ljust`) regardless of the alignment marker
- Preserves the alignment marker in the separator row (`:---`, `:---:`, `---:`), so GFM rendering still honors it
- Uses the header's column count: short body rows gain empty trailing cells and excess body cells are dropped, matching GFM rendering
- Preserves a shared zero-to-three-space Markdown indent and recognizes GFM one-cell body rows without a pipe
- Inserts a blank line before and after each table when missing

## Invocation

The script lives in this skill's directory, so pass its path (or copy it to the target dir). `allowed-tools` permits `Bash(python *)`; invoke via `python`, not `./`.

```bash
python /path/to/skills/loom-md-tables/fix-md-tables.py FILE.md      # preview to stdout
python /path/to/skills/loom-md-tables/fix-md-tables.py FILE.md -i   # -i or --in-place: rewrite
```

⚠ A pipe-separated header must be immediately followed by a valid GFM delimiter row with the same number of cells and indent. The utility preserves escaped `\|` inside cells and ignores fenced code, raw HTML blocks, four-space indented code, and lines starting another block such as a blockquote or list item. Pipe-looking prose without a delimiter row is left unchanged. Leading/trailing pipes are optional under GFM; the normalized output uses them for readability. Preview the diff when a table sits inside a complex nested container.

## Alignment Markers

| Syntax  | Alignment      |
| ------- | -------------- |
| `---`   | Left (default) |
| `:---`  | Left           |
| `---:`  | Right          |
| `:---:` | Center         |

## Verify before done

- [ ] Ran preview (no `-i`) first and eyeballed the diff before rewriting in place.
- [ ] Separator markers (`:---`, `---:`, `:---:`) survived; alignment intent intact.
- [ ] Header and delimiter counts/indents match; pipe-looking prose plus fenced/raw-HTML examples were intentionally left unchanged.

Files in this skill

  • SKILL.md3.4 KB
  • fix-md-tables.py10.8 KB
  • test_fix_md_tables.py4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.