Skip to content

MD055 - table-pipe-style

Description

This rule ensures that table rows use a consistent style for leading and trailing pipe characters. By default, the style is determined by the first table row in the document, and all subsequent rows must match. Note that text immediately following a table (i.e., not separated by an empty line) is treated as part of the table per the GFM specification and may also trigger this rule.

Rationale

Some parsers have difficulty with tables that are missing their leading or trailing pipe characters. The use of leading/trailing pipes can also help provide visual clarity and maintain consistent formatting.

Configuration

style

Required table pipe style.

  • Default: consistent
  • Options:
    • consistent: All rows must match the first row's style
    • leading_and_trailing: All rows must have leading and trailing pipes
    • leading_only: All rows must have leading pipes only
    • trailing_only: All rows must have trailing pipes only
    • no_leading_or_trailing: No rows should have leading or trailing pipes

Examples

Invalid

# Inconsistent Table Pipe Style

| Header 1 | Header 2 |
| -------- | --------
  Cell 1   | Cell 2   |

Valid

# Consistent Table Pipe Style

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

Another table with the same style:

| Name  | Value |
| ----- | ----- |
| Alpha | 100   |
| Beta  | 200   |