> For the complete documentation index, see [llms.txt](https://jeromeerasmus.gitbook.io/extended-markdown-adf-parser/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jeromeerasmus.gitbook.io/extended-markdown-adf-parser/block-elements/element-specifications-tables.md).

# Tables

## Description

Tables provide structured data presentation with rows, columns, headers, and cells. The parser supports GitHub Flavored Markdown (GFM) table syntax with extensions for custom attributes, cell spanning, and styling options.

## .md markdown syntax

### Basic Tables

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

### Tables with Alignment

```markdown
| Left | Center | Right |
|:-----|:------:|------:|
| L1   | C1     | R1    |
| L2   | C2     | R2    |
```

### Tables with Custom Attributes

```markdown
<!-- adf:table layout="full-width" borderColor="#333" -->
| Header 1 | Header 2 |
|----------|----------|
| Content  | Content  |
```

### Cell-specific Attributes

```markdown
<!-- adf:tableCell backgroundColor="#f6f6f6" -->
| Gray cell | Normal cell |
|-----------|-------------|
| Content   | Content     |
```

### Tables with Cell Spanning

```markdown
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| <!-- adf:tableCell colspan="2" --> Spans 2 columns | Cell 3 |
| Cell 1   | Cell 2   | Cell 3   |
```

## .adf-schema.json schema

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "const": "table"
    },
    "attrs": {
      "type": "object",
      "properties": {
        "isNumberColumnEnabled": {
          "type": "boolean",
          "description": "Enable row numbering"
        },
        "layout": {
          "type": "string",
          "enum": ["default", "full-width", "wide"],
          "description": "Table layout mode"
        },
        "displayMode": {
          "type": "string",
          "enum": ["default", "fixed"]
        }
      },
      "additionalProperties": true
    },
    "content": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "tableRow"
          },
          "content": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "tableHeader"
                    }
                  }
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "tableCell"
                    },
                    "attrs": {
                      "type": "object",
                      "properties": {
                        "colspan": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "rowspan": {
                          "type": "integer", 
                          "minimum": 1
                        },
                        "colwidth": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          }
                        },
                        "backgroundColor": {
                          "type": "string",
                          "pattern": "^#[0-9a-fA-F]{6}$"
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      }
    }
  },
  "required": ["type", "content"]
}
```

## Examples

### Simple Data Table

```markdown
| Product | Price | Stock |
|---------|-------|-------|
| Widget  | $10   | 50    |
| Gadget  | $25   | 25    |
| Tool    | $15   | 100   |
```

### Aligned Columns

```markdown
| Item        | Price    | Quantity |
|:------------|:--------:|---------:|
| Left align  | Center   |    Right |
| Text        | $19.99   |       42 |
```

### Full-Width Table

```markdown
<!-- adf:table layout="full-width" -->
| Column 1 | Column 2 | Column 3 | Column 4 |
|----------|----------|----------|----------|
| Data     | Data     | Data     | Data     |
```

### Table with Colored Cells

```markdown
| Status | Description |
|--------|-------------|
| <!-- adf:tableCell backgroundColor="#d4edda" --> Active | Service is running |
| <!-- adf:tableCell backgroundColor="#f8d7da" --> Error | Service is down |
| <!-- adf:tableCell backgroundColor="#fff3cd" --> Warning | Service degraded |
```

### Complex Table with Spanning

```markdown
| <!-- adf:tableCell colspan="3" --> Project Summary |
|---------------------------------------------------|
| Task | Status | Owner |
|------|--------|-------|
| Design | Complete | Alice |
| Development | <!-- adf:tableCell rowspan="2" --> In Progress | Bob |
| Testing | Pending | Bob |
```

### Table with Rich Content

```markdown
| Feature | Description | Example |
|---------|-------------|---------|
| **Bold** | Emphasis | `**text**` |
| *Italic* | Styling | `*text*` |
| Links | [Navigation](https://example.com) | `[text](url)` |
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://jeromeerasmus.gitbook.io/extended-markdown-adf-parser/block-elements/element-specifications-tables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
