markdown-tables

$npx mdskill add TheBushidoCollective/han/markdown-tables

Format and create markdown tables with precise syntax control.

  • Generates readable tables with custom column alignment and escaping.
  • Integrates with Read, Write, Edit, Grep, and Glob tools.
  • Applies best practices for alignment and pipe character handling.
  • Delivers formatted output directly within markdown documents.

SKILL.md

.github/skills/markdown-tablesView on GitHub ↗
---
name: markdown-tables
user-invocable: false
description: Use when creating or formatting tables in markdown. Covers table syntax, alignment, escaping, and best practices.
allowed-tools:
  - Read
  - Write
  - Edit
  - Grep
  - Glob
---

# Markdown Tables

Comprehensive guide to creating and formatting tables in markdown.

## Basic Table Syntax

```markdown
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |
```

Renders as:

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

## Column Alignment

```markdown
| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| Left     | Center   | Right    |
| aligned  | aligned  | aligned  |
```

Renders as:

| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| Left     | Center   | aligned  |
| text     | text     | text     |

- `:---` Left align (default)
- `:--:` Center align
- `---:` Right align

## Minimum Syntax

The pipes and dashes don't need to align:

```markdown
|Header|Header|
|-|-|
|Cell|Cell|
```

However, aligned tables are more readable in source.

## Escaping Pipe Characters

Use `\|` to include a literal pipe in a cell:

```markdown
| Command | Description |
|---------|-------------|
| `a \| b` | Pipe operator |
| `cmd \|\| exit` | Or operator |
```

## Inline Formatting in Tables

Tables support inline markdown:

```markdown
| Feature | Syntax |
|---------|--------|
| **Bold** | `**text**` |
| *Italic* | `*text*` |
| `Code` | `` `code` `` |
| [Link](url) | `[text](url)` |
```

## Multi-line Cell Content

Standard markdown tables don't support multi-line cells. Workarounds:

### Using `<br>` Tags

```markdown
| Step | Description |
|------|-------------|
| 1 | First line<br>Second line |
| 2 | Another step |
```

### Using HTML Tables

For complex layouts, use HTML:

```html
<table>
  <tr>
    <th>Header</th>
    <th>Description</th>
  </tr>
  <tr>
    <td>Item</td>
    <td>
      <ul>
        <li>Point one</li>
        <li>Point two</li>
      </ul>
    </td>
  </tr>
</table>
```

## Empty Cells

Use a space or leave empty:

```markdown
| A | B | C |
|---|---|---|
| 1 |   | 3 |
| 4 | 5 |   |
```

## Wide Tables

For tables with many columns, consider:

### Scrollable Container (HTML)

```html
<div style="overflow-x: auto;">

| Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | Col 6 |
|-------|-------|-------|-------|-------|-------|
| Data  | Data  | Data  | Data  | Data  | Data  |

</div>
```

### Vertical Layout

Transform wide tables into key-value pairs:

```markdown
### Item 1

| Property | Value |
|----------|-------|
| Name     | Foo   |
| Type     | Bar   |
| Status   | Active |
```

## Common Table Patterns

### Comparison Table

```markdown
| Feature | Free | Pro | Enterprise |
|---------|:----:|:---:|:----------:|
| Users   | 5    | 50  | Unlimited  |
| Storage | 1GB  | 10GB| 100GB      |
| Support | ❌   | ✅  | ✅         |
```

### API Reference

```markdown
| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `id`      | string | ✅ | Unique identifier |
| `name`    | string | ✅ | Display name |
| `limit`   | number | ❌ | Max results (default: 10) |
```

### Keyboard Shortcuts

```markdown
| Action | Windows/Linux | macOS |
|--------|---------------|-------|
| Copy   | `Ctrl+C`      | `⌘+C` |
| Paste  | `Ctrl+V`      | `⌘+V` |
| Undo   | `Ctrl+Z`      | `⌘+Z` |
```

### Changelog

```markdown
| Version | Date | Changes |
|---------|------|---------|
| 2.0.0 | 2024-01-15 | Breaking: New API |
| 1.2.0 | 2024-01-01 | Added feature X |
| 1.1.0 | 2023-12-15 | Bug fixes |
```

## Best Practices

1. **Keep tables simple**: If content is complex, consider alternatives
2. **Use consistent alignment**: Align source pipes for readability
3. **Header row required**: Always include a header row
4. **Escape special characters**: Use `\|` for literal pipes
5. **Limit columns**: Wide tables are hard to read
6. **Consider alternatives**: Lists or definition lists may work better
7. **Test rendering**: Tables render differently across platforms

## Markdownlint Rules for Tables

| Rule | Description |
|------|-------------|
| MD055 | Table pipe style should be consistent |
| MD056 | Table column count should match header |
| MD058 | Tables should be surrounded by blank lines |

## Alternatives to Tables

### Definition Lists (Some Parsers)

```markdown
Term 1
: Definition 1

Term 2
: Definition 2
```

### Bullet Lists with Bold Keys

```markdown
- **Name**: John Doe
- **Email**: john@example.com
- **Role**: Developer
```

### Nested Lists

```markdown
- Item 1
  - Property A: Value
  - Property B: Value
- Item 2
  - Property A: Value
  - Property B: Value
```

More from TheBushidoCollective/han

SkillDescription
absinthe-resolversUse when implementing GraphQL resolvers with Absinthe. Covers resolver patterns, dataloader integration, batching, and error handling.
absinthe-schemaUse when designing GraphQL schemas with Absinthe. Covers type definitions, interfaces, unions, enums, and schema organization patterns.
absinthe-subscriptionsUse when implementing real-time GraphQL subscriptions with Absinthe. Covers Phoenix channels, PubSub, and subscription patterns.
act-docker-setupUse when configuring Docker environments for act, selecting runner images, managing container resources, or troubleshooting Docker-related issues with local GitHub Actions testing.
act-local-testingUse when testing GitHub Actions workflows locally with act. Covers act CLI usage, Docker configuration, debugging workflows, and troubleshooting common issues when running workflows on your local machine.
act-workflow-syntaxUse when creating or modifying GitHub Actions workflow files. Provides guidance on workflow syntax, triggers, jobs, steps, and expressions for creating valid GitHub Actions workflows that can be tested locally with act.
ameba-configurationUse when configuring Ameba rules and settings for Crystal projects including .ameba.yml setup, rule management, severity levels, and code quality enforcement.
ameba-custom-rulesUse when creating custom Ameba rules for Crystal code analysis including rule development, AST traversal, issue reporting, and rule testing.
ameba-integrationUse when integrating Ameba into development workflows including CI/CD pipelines, pre-commit hooks, GitHub Actions, and automated code review processes.
analyze-performanceAnalyze performance metrics and identify slow transactions in Sentry