mdx-formatter

Type to search...

to open search from anywhere

recover-escaped-tables-in-lists

Re-indent GFM tables that escaped to column 0 between two list items

When an AI author writes a GFM table between two numbered list items without indenting it, CommonMark parses it as a root-level table and breaks the list. This rule detects that shape and re-indents the table to the preceding item’s continuation column.

Modes

ValueDefaultBehavior
"off"Never touch. Output is byte-identical for this rule.
"safe"Fire only for numbering runs (`1. …
"aggressive"Additionally fire on bullet-list pairs (`- …

Config

{
  "recover-escaped-tables-in-lists": "safe"
}

Example

Before:

1. before

| a | b |
| - | - |
| 1 | 2 |

2. after

After ("safe" — default):

1. before

   | a | b |
   | - | - |
   | 1 | 2 |

2. after

Every row is re-indented by 3 spaces. Alignment colons in the separator row (e.g. | :-- | --: |) are preserved byte-for-byte.

Notes

  • Legitimate top-level tables (no enclosing list) are never touched in any mode.
  • The rule is idempotent and runs before tighten-list-continuations in the formatter pipeline.

Revision History