Skip to content

[lexical-mdast][lexical-website] Feature: GFM tables in @lexical/mdast - #9478

Merged
etrepum merged 135 commits into
meta:mainfrom
etrepum:claude/mdast-gfm-tables-9323
Oct 27, 2026
Merged

etrepum merged 135 commits into
meta:mainfrom
etrepum:claude/mdast-gfm-tables-9323

Conversation

@etrepum

@etrepum etrepum commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Breaking changes

  • @lexical/mdast (experimental) no longer stores column alignment in the mdastTableAlign NodeState. Alignment is now the element format of the cells' paragraphs, so editor states serialized with that state lose their column alignment on load.

Description

MdastTableExtension now reads tables the way GFM does and writes any table as a GFM table, lossily where GFM has no form for what the table holds. The codec doesn't restrict what the editor can put in a table. Changes are limited to @lexical/mdast, its mdast-editor dev example and docs; @lexical/markdown, @lexical/table and the playground are untouched.

Import:

  • Body rows take the header row's cell count (padded or truncated, as GFM renders them).
  • In Markdown parsed with the editor's grammar, \| is read as | in raw HTML and in autolinks in a cell (the raw HTML of an mdast tree passed to $convertFromMdast is taken as it is), and a raw HTML <br> (any spelling, such as <br/> or </br>) in a cell is a line break.
  • Column alignment becomes the element format of the paragraph in each cell of the column.

Export:

  • A cell's content is exported by its export rules, and the blocks that come out (and their line breaks) are written as lines separated by <br>, a code block's lines as inline code.
  • A merged cell is written where it starts, with empty cells where it spans; ragged rows are padded.
  • Blocks with no inline form (such as a horizontal rule) are written after the table.
  • A column's alignment is the format of the text in its header cell; a format GFM can't express (start, end, justify) and the alignment of body cells are dropped.
  • Pipes are escaped wherever GFM would end the cell, and whitespace at a cell's edges is written as character references so the cell trim keeps it.
  • A selection export writes only the rows and columns it reaches, and a text or node selection within one cell writes that cell's blocks, as copying in a cell does. Export rules can read the selection as the new read-only MdastExportContext.selection.

Other mdast changes:

  • Text both bold and italic is written as emphasis around strong, so ***x*** and ___x___ round-trip with mdast-util-to-markdown 2.2 (**_x_** comes back as _**x**_).

The dev example gets table editing (Insert > Table, and a Table menu for rows, columns and column alignment). Its footnote merge regroups formatted refs with the text around them the way core groups text runs. mdast-util-from-markdown, mdast-util-to-markdown and micromark-extension-gfm-table are bumped to their latest versions.

RE #9323 (left open as this does not fix @lexical/markdown)

Test plan

Before

On main, a line break in a cell is written as a space, imported body rows keep their own cell counts, and merged cells or blocks in cells are written as Markdown that GFM parses into a different table.

After

New unit tests in MdastTable.test.ts and MdastHtmlExtension.test.ts cover round trips, escaping, spans, alignment and selection export; TableEditing.test.ts covers table editing in the dev example in the browser.

claude added 30 commits October 23, 2026 15:16
## Description

`MdastTableExtension` read and wrote tables that GFM can't hold the same way: a cell's paragraphs and line breaks were written as spaces, rows kept the cells they were written with instead of the header row's, `\|` stayed escaped in raw HTML and autolinks, a pipe in raw HTML split the row, and the editor let a table hold what Markdown loses (blocks and several paragraphs in a cell, merged cells, header cells outside the first row, alignment per cell).

Tables are now kept to GFM: the first row is the header row, a cell holds one paragraph of inline content whose line breaks are written as `<br>` (Enter in a cell inserts one, and `<br>` reads back as one), blocks put into a cell become lines of it, merged cells are split, and a column's alignment is the element format of its cells, read from the header cell, and set by aligning a block in any of its cells. Import gives every row the header row's cells and reads `\|` as a pipe in raw HTML and autolinks too. The column alignment NodeState is gone. mdast-util-from-markdown, mdast-util-to-markdown and micromark-extension-gfm-table are updated to their latest releases.

The mdast-editor dev example gets `TableExtension`, Insert > Table, a Table menu and a Tables section in its demo.

Closes meta#9323

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × gives each row the header row’s cells
     × reads alignment into the cells of each column and writes it back
     × reads <br> in a cell as a line break and writes it back
     × reads and writes the pipes in a cell as GFM does
     × inserts a line break for Enter in a cell
     × joins the blocks put into a cell into lines of one paragraph
     × keeps the first row the header row
     × aligns a column when a block in one of its cells is aligned
     × clears an alignment GFM has no form for
      Tests  9 failed | 3 passed (12)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
      Tests  12 passed (12)
$ vitest run --project browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ictTableExtension

## Description

The first commit made `MdastTableExtension`, which `MdastGfmExtension` includes, change table editing for every editor that reads Markdown tables. The editing constraints now live in the opt-in `MdastStrictTableExtension`, which adds `TableExtension` (without cell background colors); `MdastTableExtension` only reads and writes tables.

Export now builds its own grid of the table, so it skips children that aren't rows or cells instead of throwing, writes a merged cell with empty cells where it spans, and aligns every column a merged header cell spans. Normalizing reads column alignment before splitting merged cells, moves block decorators after the table instead of deleting them, and moves a selection point on a removed block to its line in the joined paragraph. Enter inserts a line break only when the whole selection is in one cell. The dev example's Table menu acts on a table selection too.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × splits merged cells, keeping the alignment of their columns
```

### After

```
$ vitest run --project unit packages/lexical-mdast dev-examples/mdast-editor
      Tests  272 passed (272)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…trict GFM tables

## Description

Review fixes for the GFM table support:

- `MdastStrictTableExtension` took a column's alignment from its header cell only, so inserting a row above the header cleared every column; it now takes the first alignment the column's cells have, and an alignment GFM has no form for (justify, start, end) on a pasted or formatted block no longer clears it. Aligning the whole table (which `TableExtension` sets on the table node) aligns every column. A row span past the last row is cut before the cell is split, which threw.
- Block shortcuts (`# `, `- `, `> `, a fence + Enter) converted a cell's paragraph into a block the strict mode then flattened, losing the marker; a marker typed in a table cell now stays text.
- `$convertToMdast` returned table cells with `<br>` HTML nodes and escaped pipes in raw HTML; cells keep `break` nodes, and serialization writes them as `<br>` and escapes pipes in raw HTML (and `htmlBlock` segments, whose line endings become spaces).
- Import read a table with no rows as an error; it now imports nothing. Escaped pipes are read as pipes in GFM autolink literals too. A selection export no longer starts a cell with `<br>` for a line it leaves out.
- A selection point on a block a cell's rebuild removes keeps its place among the lines. The dev example's column alignment applies to every cell of every selected column.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × reads escaped pipes in autolink literals
     × imports a table with no rows as nothing
     × keeps a line break in a cell a break in mdast
     × ignores an alignment GFM has no form for
     × keeps column alignment when a row is inserted above the header
     × aligns every column when the whole table is aligned
     × cuts a row span past the last row
     × leaves a block marker typed in a cell as text
      Tests  8 failed | 14 passed (22)
```

### After

```
$ vitest run --project unit packages/lexical-mdast dev-examples/mdast-editor
      Tests  279 passed (279)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…pty lines and shortcuts

## Description

Review fixes for the GFM table support:

- A pipe after a backslash in raw HTML was escaped as `\\|`, which GFM reads as an escaped backslash and a cell boundary, splitting the cell. Raw HTML in a cell (and `htmlBlock` segments) now escapes each pipe after an even run of backslashes, and its line endings, and those of an `htmlBlock`'s Markdown children, are written as spaces. The escaping is done on the mdast table cells rather than by a to-markdown `html` handler, which replaced any other extension's.
- A GFM autolink literal with a pipe, which import reads, was written back unescaped, splitting the cell; it is escaped in a cell.
- An empty line at the start of a cell lost its `<br>`, and a selection export wrote empty lines outside the selection; a selection export now writes the lines from the first it reaches to the last.
- A block marker typed at the start of a quote in a cell still adopted the block, as it did in a paragraph before. The check no longer imports `@lexical/table`, which grew bundles of the shortcuts without tables by about 7 kB minified.
- A cell rebuilt from several blocks lost the text format and style of its first block, which text typed into an empty cell takes.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × reads and writes escaped pipes in autolink literals
     × escapes the pipes in raw HTML in a cell after any backslashes
     × writes the empty lines at the edges of a cell
     × writes the lines of a cell a selection reaches
     × keeps the text format of the first block of a joined cell
     × leaves a block marker typed in a quote in a cell as text
      Tests  6 failed | 21 passed (27)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit
      Tests  241 passed (241)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… cells in one place

## Description

Review fixes for the GFM table support:

- `MdastStrictTableExtension` realigned a whole column when any block in one of its cells had a GFM alignment, so pasting a left-aligned paragraph into a centered column made the column left-aligned. It now handles `FORMAT_ELEMENT_COMMAND` in a table (ahead of `TableExtension`) by aligning the columns from the selection's anchor cell to its focus cell, ignores alignments GFM has no form for, and clears the formats of the table and of blocks in cells. The dev example's column alignment dispatches the command.
- What a cell can't hold as it is was handled in four places, one of them escaping raw HTML in the mdast tree that `$convertToMdast` returns. It is now done once, by wrapping the `gfm-table` to-markdown table handler: a break is written as `<br>`, and raw HTML, `htmlBlock` values and autolink literals have their pipes escaped. `$convertToMdast` keeps a cell's HTML as it is.
- A cell with a row span of 0 (HTML `rowspan="0"`, the rest of the rows) was left out of the table grid, losing its content and moving the next cell into its column. It is read as spanning the rest of the rows, and strict normalization cuts it to them before splitting; a column span of 0 is read as 1.
- Plain `MdastTableExtension` export dropped the block decorators of a cell; they are written after the table, where strict mode moves them.
- The import and serialization of cells copied every phrasing node with children; nodes are copied only where something in them changed.
- `MdastStrictTableExtension` is listed in the package README and the included-extensions page.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × reads a row span of 0 as the rest of the rows
     × writes the block decorators of a cell after the table
     × escapes the pipes in raw HTML in a cell after any backslashes
     × aligns the columns a selection spans
     × ignores the alignment of a block in a cell
     × clears the alignment of the table
      Tests  6 failed | 23 passed (29)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  243 passed (243)
      Tests  43 passed (43)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… place

## Description

What a GFM cell can't hold was handled node type by node type (breaks, raw HTML, `htmlBlock`, autolink literals), in `MdastTableExtension` and in `MdastHtmlExtension`'s `htmlBlock` handler, and the rest still broke cells: a `<…>` autolink with a pipe was written with `%7C`, changing its text and URL, and inline code with a backslash before a pipe was written as `\\|`, which ends the cell.

The table handler now writes each cell's content as it would be written outside a table, with a line break as `<br>`, line endings as spaces, and each pipe where GFM would end the cell (one after an even run of backslashes) escaped, then hands the line to `gfm-table`'s handler. This covers every handler, and `MdastHtmlExtension` and `handlers.ts` are back to main's. A pipe after an odd run of backslashes, which a cell can't hold (GFM reads `\|` in a cell as a pipe first), is written as it is.

Also: the export's row width no longer spreads one argument per row, column alignment computes its column range once, and normalization builds the table grid again only after splitting a merged cell.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × reads and writes the pipes in a cell as GFM does
     × escapes the pipes in raw HTML in a cell after any backslashes
      Tests  2 failed | 27 passed (29)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  286 passed (286)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ble cells as text

## Description

- The block shortcut guard only checked a paragraph's own parent, so a marker typed in a paragraph inside a shadow-root container in a table cell (a shadow-root quote, say) still made a block, which the table export writes as a plain line. It now checks every ancestor for a table cell.
- Importing a table no longer copies raw HTML and autolink nodes that have no escaped pipe.
- `$markTableDirty` uses `$findTableNode`, and `$tableGrid` returns `{grid, rows}`.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × leaves a block marker typed in a paragraph in a container in a cell as text
      Tests  1 failed | 29 passed (30)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit
      Tests  244 passed (244)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
## Description

- GFM trims a cell, so a space or tab at the start or end of a cell's content was lost on the next import. The cell writer now encodes it (`&#x20;`, `&#x9;`), as a paragraph's edge spaces are.
- Enter in a cell under `MdastStrictTableExtension` inserted a line break directly, skipping `INSERT_LINE_BREAK_COMMAND` handlers that Shift+Enter goes through. It now dispatches that command, and inserts the break itself only when nothing handles it.
- Column alignment no longer consumes `FORMAT_ELEMENT_COMMAND` when it finds no column for the selection.
- The dev example's theme sets `tableSelection`, which hides the native text selection across a multi-cell selection.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × keeps the spaces at the edges of a cell
      Tests  1 failed | 30 passed (31)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  288 passed (288)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… table

## Description

- A selection export wrote a cell the selection didn't reach in full when all its lines were empty, and a selection that reached only a block decorator in a cell wrote a table of empty cells before it. An empty line now counts as reached when its block (or the cell) is, a cell is written from the first line reached to the last, a row with no cell reached is skipped, and a table with no row left is left out, with its reached block decorators still written.
- A cell ending in a backslash and a space was written as `x\&#x20;`, which reads back as `x&#x20;`; the backslash is escaped before the encoded space.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × keeps the spaces at the edges of a cell
     × writes nothing of a cell a selection doesn’t reach
      Tests  2 failed | 30 passed (32)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit
      Tests  246 passed (246)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…erges, edge selections and empty tables

## Description

- `MdastStrictTableExtension` took each column's alignment from the first aligned cell in it, so merging two body cells of a centered and an unaligned column, which splits back into two centered cells, centered the second column. Columns now take the alignment of the first row with an aligned cell (the header row, unless a row was inserted above it).
- A caret on a block decorator moved out of a cell landed at the end of the cell; it now lands at the start of the line after the decorator.
- `FORMAT_ELEMENT_COMMAND` with a selection from a cell to a block after the table aligned nothing in the table. The columns of the cells the selection reaches in each table are aligned, and blocks outside a table are formatted as usual.
- A table with rows but no cells was written as blank lines, and strict mode kept it. Export leaves it out and strict mode removes it.
- Export computes each cell's lines and reached block decorators in one pass before writing rows, instead of from inside a predicate.
- The block shortcut guard uses `$findMatchingParent`.
- The mdast docs no longer list table column alignment among the syntax kept with NodeState, and note that `MdastStrictTableExtension` normalizes tables.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × keeps a caret before a block decorator before the line after it
     × leaves out a table with no cells (strict: true)
     × leaves out a table with no cells (strict: false)
     × keeps the alignment of a column a merged body cell spans
     × aligns the columns of a selection that ends after the table
      Tests  5 failed | 32 passed (37)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  251 passed (251)
      Tests  43 passed (43)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…heckboxes in cells as text

## Description

- Export read column alignment from the first row only, while `MdastStrictTableExtension` used the first row with an aligned cell, so without strict mode a row inserted above the header dropped every column's alignment. Both now read it the same way, through one helper.
- `FORMAT_ELEMENT_COMMAND` with a selection from one table to another aligned both tables but consumed the command, leaving the blocks between them unformatted. It now leaves the command to the default handler unless the selection starts and ends in one table.
- A `[ ] ` typed in a list item in a table cell still made a check list, whose marker the cell export drops; it stays text, as other block markers in a cell do.
- Column alignment tracks the column range while walking the grid instead of spreading an array into `Math.min`/`Math.max`, `mapPhrasing` maps the children of replacement nodes too (so import no longer recurses by hand), and `$cellLines` uses `$isBlockLevelNode`.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the alignment of the first aligned row
     × aligns the columns of a selection from one table to another
     × leaves a checkbox typed in a list item in a cell as text
      Tests  3 failed | 37 passed (40)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  254 passed (254)
      Tests  43 passed (43)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…per export

## Description

No change in output:

- Export computed the column alignment once per column, scanning the whole table each time; it computes it once. The docs and comments now describe the rule the code follows (the first row with an aligned cell, the header row unless a row was inserted above it).
- Export walked the rows twice, once to compute cell lines and once to write them; it computes a row's cell lines as it writes the row.
- `FORMAT_ELEMENT_COMMAND` finds the cells a selection reaches among the selected nodes and the anchor and focus, instead of walking up from every selected node, and skips the grid walk for an alignment GFM has no form for.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  254 passed (254)
      Tests  43 passed (43)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  297 passed (297)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…to the focus cell

## Description

- `FORMAT_ELEMENT_COMMAND` with a selection across rows of one table aligned the column range of every cell between the endpoints in document order, so a selection from one cell to the cell below it aligned every column. In a table the selection starts and ends in, only the columns from the anchor cell to the focus cell are aligned; in a table it leaves, those of the cells it reaches.
- `MdastStrictTableExtension`'s docs describe the alignment rule the code follows (the first row with an aligned cell).
- The import's `<br>` check drops a children guard no `<br>` node can fail.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × aligns the columns from the anchor cell to the focus cell
      Tests  1 failed | 40 passed (41)
```

### After

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit dev-examples/mdast-editor
      Tests  298 passed (298)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…decorator-only rows past a merge

## Description

- Without `MdastStrictTableExtension`, aligning the text in a cell (which rich text sets on the cell's paragraph) was not written: export read only the cell's own format. Export now reads a cell with no alignment of its own by its first block's; strict mode moves that alignment to the column and clears the block's, so it is unaffected.
- A selection export that reached only a block decorator in a row still wrote the row (empty) when a merged cell from an earlier row spanned it; only the cells that start in a row count toward writing it.
- Column alignment returns at once for an alignment GFM has no form for, without building the table grid.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the alignment of the text in a cell as its column’s
     × skips a row where a selection reaches only a block decorator
      Tests  2 failed | 41 passed (43)
```

### After

```
$ vitest run --project unit packages/lexical-mdast dev-examples/mdast-editor
      Tests  300 passed (300)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…pasted cell alignment

## Description

- The decorator-only row skip from the previous commit also dropped, in a full export, a row every cell of which a merged cell from above spans. A row counts the cells that start in it, or those spanning it when none does.
- `MdastStrictTableExtension` cleared a column alignment that was only on the cells' paragraphs, which is where `@lexical/table` puts the alignment of a pasted HTML table. Normalization reads a cell with no alignment of its own by its first block's, as export does, before clearing the block's.
- Strict mode no longer removes a table with no cells, which may be one built across several updates; export leaves it out.
- Column alignment checks for a GFM alignment before collecting the selected cells.
- The dev example's column alignment dispatches whenever there is a selection, so a selection that starts outside a table aligns the columns it reaches.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes a row a merged cell spans with an empty cell
     × aligns a column by the text of its cells, as a pasted table is
      Tests  2 failed | 43 passed (45)
```

### After

```
$ vitest run --project unit packages/lexical-mdast dev-examples/mdast-editor
      Tests  302 passed (302)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… column alignment

## Description

- `FORMAT_ELEMENT_COMMAND` with a selection reaching into a table from outside (or from one table to another) left the command to rich text, which formats the cells and their paragraphs too: a justify from outside cleared the alignment of the columns it reached, and the blocks between two tables were left unformatted when both ends were in cells. Whenever the selection reaches a cell, the command now formats the blocks outside tables itself, as rich text does, and aligns the columns it reaches (or nothing, for justify, start and end).
- A cell's alignment is its first block's, if that has one, then its own. Export without `MdastStrictTableExtension` wrote a column's imported alignment even after the text in its header cell was aligned otherwise.
- The dev example's column alignment needs the selection to start or end in a cell, so it no longer aligns ordinary paragraphs.

## Test plan

### Before

```
$ vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the alignment of the text in a cell over the cell’s
     × aligns the columns of a selection from one table to another
      Tests  2 failed | 45 passed (47)
```

### After

```
$ vitest run --project unit packages/lexical-mdast dev-examples/mdast-editor
      Tests  304 passed (304)
$ vitest run --project browser dev-examples/mdast-editor
      Tests  28 passed (28)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n and trim selection exports

## Description

A table's column alignment was taken from the first row with any aligned cell, so a merged header cell aligned the columns it spanned and a column aligned only below that row lost its alignment. Selection exports also wrote every column of the table, empty for cells the selection did not reach.

Each column's alignment is now that of the first cell from the top that starts in the column and is aligned (a cell has the alignment of its first block, or else its own), and the strict extension reads it before splitting merged cells. A selection export writes only the columns from the first to the last that the selection reaches. The dev example's table menu acts only when the anchor and focus are in cells of the same table.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes a merged cell with empty cells where it spans
     × writes nothing of a cell a selection doesn’t reach
     × exports only the rows and columns a selection reaches
     × exports only the columns a table selection spans
     × splits merged cells, keeping the alignment of their columns
      Tests  5 failed | 43 passed (48)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  262 passed (262)
$ pnpm run test-browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…n from a selection leaving a table

## Description

The dev example's table menu dropped alignment actions for a selection running from a table cell out of the table, though `MdastStrictTableExtension` aligns the columns such a selection reaches. Alignment actions now dispatch `FORMAT_ELEMENT_COMMAND` when either end is in a cell; row and column actions still need both ends in cells of one table. The import's pipe unescaping is a module-level function instead of a closure made for each table.

## Test plan

### Before

The menu returned before dispatching for such a selection; no test covered the case.

### After

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
      Tests  48 passed (48)
$ pnpm run test-browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e table cell as its content

## Description

A selection export that reached a single table cell, such as a word selected in a cell, was written as a one-cell GFM table with a delimiter row, so copying text from a cell as Markdown pasted a table. It is now written as the cell's content, as Lexical's own copy of text in a cell does. The column helper in the table export is generic instead of casting a union, and the docs state that a cell's first block's alignment comes before the cell's own.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the lines of a cell a selection reaches
     × writes nothing of a cell a selection doesn’t reach
     × exports only the rows and columns a selection reaches
      Tests  3 failed | 45 passed (48)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  262 passed (262)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…and export one merged cell as its content

## Description

A selection export that stayed in one merged cell spanning columns was still written as a table, as the single-cell check counted the columns the cell spans. A node selection in a table cell fell through to rich text, which aligned the paragraph rather than the column. The single-cell check now counts cells, `FORMAT_ELEMENT_COMMAND` aligns the columns of the cells a node selection reaches, and the selection's nodes are walked once. Strict normalization now reads a cell's spans with the same helper as the grid and sets every span before splitting merged cells.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the content of a merged cell a selection stays in
     × aligns the column of a node selection in a cell
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  264 passed (264)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…a cell, and let a block's format decide its cell's alignment

## Description

A selection export that reached one cell was written as that cell's content even when the selection started outside the table or covered the whole table, so copying a one-cell table, or from a paragraph into a cell, dropped the table. The content form is now used only when the selection starts and ends in that cell. A cell's first block with a format GFM has no alignment for (start, justify) fell back to the cell's alignment, so a column showed unaligned text but exported aligned; the block's format now decides when it has one. Strict normalization splits the latest version of a cell whose span it corrected, and the dev example's alignment menu works for a node selection in a cell.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes a column unaligned when the text in its cell is
     × writes a table a selection leaves or holds whole
      Tests  2 failed | 51 passed (53)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  267 passed (267)
$ pnpm run test-browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ide its alignment, and copy blocks in a cell as paragraphs

## Description

A column's alignment came from the first cell with a GFM alignment, so a header whose text was justified or set to start fell through to the body cells' imported alignment, and the column was written aligned though its header text wasn't. The first cell from the top with any format now decides, and a format GFM can't express leaves the column unaligned. A selection export that stays in one cell joined the cell's blocks with soft breaks, which read back as one line; each block is now a paragraph. The cells a selection leaving a table reaches are read from its nodes alone.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes a column unaligned when the text in its header is
     × writes the blocks a selection in a cell reaches as paragraphs
      Tests  2 failed | 53 passed (55)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  269 passed (269)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…olumn alignment rule as implemented

## Description

The JSDoc of `MdastTableExtension` and the mdast docs page said a column's alignment comes from its first aligned cell; it comes from its first cell with an element format, and a format GFM can't express leaves the column unaligned.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ell's nodes

## Description

A selection export that stayed in one cell was written by flattening the cell to lines, and only for range selections whose ends were in that cell. A block decorator in the cell moved after the content, a node selection of an inline or block decorator in a cell still wrote a table, and a selection in a nested table's cell wrote the outer table's cell as a table. When every node the selection holds is in one cell, the cell's children are now exported as they are, in order, nested tables included.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes the nodes a selection in a cell reaches in order
     × writes a nested table a selection stays in
      Tests  2 failed | 55 passed (57)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  271 passed (271)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ends

## Description

Whether a selection export was inside one cell was decided by the nodes it holds, so a selection of a whole document that is one one-cell table (ends on the root) was written as the cell's text, and every table re-walked the selection's nodes. It is now decided by the selection's anchor and focus (or a node selection's nodes) before the table's lines are computed. Strict normalization reads the selection once per table instead of once per cell, and table import checks a link's URL for an escaped pipe before reading its source marker.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes a one-cell table a selection holds whole
      Tests  1 failed | 58 passed (59)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  272 passed (272)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
## Description

`$formatColumns` and the dev example's table menu compared the table nodes found from the anchor and focus cells with `===`, which holds only while neither lookup returns a newer version of the node. They now compare with `is()`, by key.

## Test plan

### After

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
      Tests  58 passed (58)
$ pnpm run test-browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ring a selection export

## Description

Whether a selection export of a table wrote only the content of one cell was decided from the selection in the render context alone, so a whole-document export run during a selection export (as a contributed root handler may run one) also replaced a table holding the selection by that cell's content. The shortcut now also needs the export to reach no other cell of the table. The cell's content is exported with `exportBlocks`, so inline children directly in a cell are wrapped in paragraphs rather than written as bare phrasing under a block parent.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes whole tables in a document export during a selection export
AssertionError: expected [ 'paragraph' ] to deeply equal [ 'table' ]
      Tests  1 failed | 58 passed (59)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  273 passed (273)
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e exporter's selection

## Description

The table export decided whether a selection stayed in one cell from the selection in the render context, so a whole-document export run during a selection export (as a contributed root handler may run one) wrote a one-cell table as the cell's content. A table selection of exactly one cell, an explicit cell selection, was also written as the cell's content rather than a table.

`MdastExportContext` gains `selection`, the selection an export is limited to (`null` for a whole-document export, including one run during a selection export), and the table export reads it. Only range and node selections in one cell write the cell's content; a table selection writes a table.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × writes whole tables in a document export during a selection export
     × writes a table selection of one cell as a table
AssertionError: expected [ 'paragraph' ] to deeply equal [ 'table' ]
AssertionError: expected '2' to be '|  2 |\n| -: |' // Object.is equality
      Tests  2 failed | 58 passed (60)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  274 passed (274)
$ pnpm run flow
Found 0 errors
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ion export

## Description

`RenderContextMarkdownSelection` carried the outer selection into a whole-document export that a handler runs during a selection export, so export rules reading it, such as the dev example's footnote definitions, treated that export as a selection export. `$convertToMdast` and `$convertToMarkdownString` now run with it set to `null`, and the table export reads it again instead of the `MdastExportContext.selection` field added for that case, which is removed. A selection export returns nothing for a table it doesn't reach without building the table's grid, and the dev example's column alignment menu acts only when every selected node is in a table, so it no longer realigns paragraphs outside it.

## Test plan

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  274 passed (274)
$ pnpm run test-browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  2 passed (2)
```

The existing test "writes whole tables in a document export during a selection export" covers the nested export.

Browser tests ran in Chromium only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
## Description

The table export read the selection from the render context, and document exports reset that context, both of which need an active editor, so exporting from `editorState.read()` without one (an update listener, a server) threw "Unable to find an active editor", even for a document with no table. `MdastExportContext` gains `selection`, the selection an export is limited to (`null` for a whole-document export), which the table export reads instead; document exports reset the render context's selection only while a selection export is running, which already has an editor.

## Test plan

### Before

```
$ npx vitest run --project unit packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts
     × exports a table from an editor state read without an editor
Error: Unable to find an active editor. This method can only be used synchronously during the callback of editor.update(), editor.read(), or editor.getEditorState().read(..., {editor}). Detected on the page: 0 compatible editor(s) with version "0.52.0+git"
      Tests  1 failed | 60 passed (61)
```

### After

```
$ npx vitest run --project unit packages/lexical-mdast
      Tests  275 passed (275)
$ pnpm run flow
Found 0 errors
```

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…e cell's place

## Description

Whitespace text between a supplied table's rows or cells is skipped, but the check used `trim()`, which also strips non-breaking and other Unicode spaces, so a text node of only U+00A0 in a cell's place was dropped and later cells moved a column. Only spaces, tabs and line endings, Markdown's whitespace, count now.

## Test plan

### Before

`npx vitest run packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts`

```
     × reads phrasing content a supplied tree holds for a row or a cell 15ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
      Tests  1 failed | 59 passed (60)
```

### After

`npx vitest run packages/lexical-mdast dev-examples/mdast-editor`

```
 Test Files  13 passed (13)
      Tests  368 passed (368)
```

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow, and a no-break space as cell content

## Description

- A supplied table holding cells (or phrasing content) outside a row made a row of each, spreading cells meant for one row down a column. Each run of them is now read as a row of cells, and a table without a row of cells takes its width from its first such run.
- Choosing a column's alignment from its header cell skipped text that `trim()` empties, including a no-break space, which is content in Markdown. Only spaces, tabs and line endings are skipped now, as on import.

## Test plan

### Before

`npx vitest run packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts`

```
     × reads phrasing content a supplied tree holds for a row or a cell 17ms
     × reads the alignment of a header cell from a no-break space 3ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
      Tests  2 failed | 59 passed (61)
```

### After

`npx vitest run packages/lexical-mdast dev-examples/mdast-editor`

```
 Test Files  13 passed (13)
      Tests  369 passed (369)
```

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in a table cell

## Description

A supplied `html` node of a break tag with whitespace around it is a cell's line break, but the tag pattern used JavaScript's `\s`, which also matches a no-break space and other Unicode spaces. So `<br> ` became a bare break and lost its no-break space, and `<br >` (not a `br` element to an HTML parser) was read as one. The pattern now takes only HTML's whitespace (space, tab, line feed, form feed, carriage return).

## Test plan

### Before

`npx vitest run packages/lexical-mdast/src/__tests__/unit/MdastTable.test.ts`

```
     × keeps a supplied html node with more than a break tag in it whole 13ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
      Tests  1 failed | 60 passed (61)
```

### After

`npx vitest run packages/lexical-mdast dev-examples/mdast-editor`

```
 Test Files  13 passed (13)
      Tests  369 passed (369)
```

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 27, 2026 4:52pm UTC
lexical-playground Ready Ready Preview Oct 27, 2026 4:52pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 27, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Oct 27, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
lexical

npm i https://pkg.pr.new/lexical@9478

@lexical/a11y

npm i https://pkg.pr.new/@lexical/a11y@9478

@lexical/clipboard

npm i https://pkg.pr.new/@lexical/clipboard@9478

@lexical/code

npm i https://pkg.pr.new/@lexical/code@9478

@lexical/code-core

npm i https://pkg.pr.new/@lexical/code-core@9478

@lexical/code-prism

npm i https://pkg.pr.new/@lexical/code-prism@9478

@lexical/code-shiki

npm i https://pkg.pr.new/@lexical/code-shiki@9478

@lexical/compiler

npm i https://pkg.pr.new/@lexical/compiler@9478

@lexical/devtools-core

npm i https://pkg.pr.new/@lexical/devtools-core@9478

@lexical/dragon

npm i https://pkg.pr.new/@lexical/dragon@9478

@lexical/eslint-plugin

npm i https://pkg.pr.new/@lexical/eslint-plugin@9478

@lexical/extension

npm i https://pkg.pr.new/@lexical/extension@9478

@lexical/fast-check

npm i https://pkg.pr.new/@lexical/fast-check@9478

@lexical/file

npm i https://pkg.pr.new/@lexical/file@9478

@lexical/hashtag

npm i https://pkg.pr.new/@lexical/hashtag@9478

@lexical/headless

npm i https://pkg.pr.new/@lexical/headless@9478

@lexical/history

npm i https://pkg.pr.new/@lexical/history@9478

@lexical/html

npm i https://pkg.pr.new/@lexical/html@9478

@lexical/internal

npm i https://pkg.pr.new/@lexical/internal@9478

@lexical/link

npm i https://pkg.pr.new/@lexical/link@9478

@lexical/list

npm i https://pkg.pr.new/@lexical/list@9478

@lexical/mark

npm i https://pkg.pr.new/@lexical/mark@9478

@lexical/markdown

npm i https://pkg.pr.new/@lexical/markdown@9478

@lexical/mdast

npm i https://pkg.pr.new/@lexical/mdast@9478

@lexical/offset

npm i https://pkg.pr.new/@lexical/offset@9478

@lexical/overflow

npm i https://pkg.pr.new/@lexical/overflow@9478

@lexical/plain-text

npm i https://pkg.pr.new/@lexical/plain-text@9478

@lexical/react

npm i https://pkg.pr.new/@lexical/react@9478

@lexical/rich-text

npm i https://pkg.pr.new/@lexical/rich-text@9478

@lexical/selection

npm i https://pkg.pr.new/@lexical/selection@9478

@lexical/table

npm i https://pkg.pr.new/@lexical/table@9478

@lexical/tailwind

npm i https://pkg.pr.new/@lexical/tailwind@9478

@lexical/text

npm i https://pkg.pr.new/@lexical/text@9478

@lexical/utils

npm i https://pkg.pr.new/@lexical/utils@9478

@lexical/yjs

npm i https://pkg.pr.new/@lexical/yjs@9478

commit: 4e88619

@etrepum
etrepum marked this pull request as ready for review October 27, 2026 16:48
…refox

## Description

The Enter and Shift+Enter table cell tests in the mdast-editor dev example called `editor.focus()`, which only sets the DOM selection. That focuses the contenteditable root in Chromium but not in Firefox, so in Firefox the typed keys were dropped and the table came back unchanged. The tests now focus the window and the root directly before placing the selection, as the other browser tests do.

## Test plan

### Before

```
$ VITEST_BROWSER=firefox vitest run --project browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
   × {Enter} in a table cell writes a <br> line break
   × {Shift>}{Enter}{/Shift} in a table cell writes a <br> line break
AssertionError: expected '| a | b |\n| - | - |\n| 1 | 2 |' to be '| a      | b |\n| ------ | - |\n| 1<b…'
      Tests  2 failed | 2 passed (4)
```

### After

```
$ VITEST_BROWSER=firefox vitest run --project browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  4 passed (4)
$ VITEST_BROWSER=chromium vitest run --project browser dev-examples/mdast-editor/src/__tests__/browser/TableEditing.test.ts
      Tests  4 passed (4)
```

WebKit was not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@etrepum
etrepum added this pull request to the merge queue Oct 27, 2026
Merged via the queue into meta:main with commit f0b3c8a Oct 27, 2026
50 checks passed
@zurfyx zurfyx mentioned this pull request Oct 27, 2026
zurfyx added a commit that referenced this pull request Oct 27, 2026
…ed since #9353

## Description

The changesets in this PR covered main up to #9353. Since then, 27 PRs
that change a published package's shipped code have merged without one,
so the v0.53.0 release would list them only under "All changes". This adds
a changeset for each, with a `PR:` line and the author's handle:

- `[breaking]`: #9478 (`@lexical/mdast` table alignment moves out of the
  `mdastTableAlign` NodeState) and #9329 (`reconcileObservedMutation`,
  `@internal`), both with `Migration:` and `Detect:`.
- `[feature]`: #9452, #9421, #9380 (experimental), #9360, #9365.
- `[perf]`: #9349.
- `[fix]`: the remaining 19. #9396, #9392, #9270 and #9360 carry `Verify:`
  because they change observable output.

Website, playground, devtools, CI and internal lint changes need none.

## Test plan

### Before

```
$ git log --format=%s fd661f0..origin/main   # merged since this PR's base
(27 PRs touching published packages' src/flow, none with a changeset)
```

### After

```
$ pnpm run check-changesets
Changeset check passed: 54 pending changeset(s) valid.

$ pnpm run changelog
## v0.53.0 (2026-10-27)
### Breaking changes
- **lexical, @lexical/clipboard, @lexical/selection, @lexical/table**: Let mouse drags select across inline decorators; ... (#9329)
- **@lexical/mdast**: `MdastTableExtension` reads and writes GFM tables, ... (#9478)
- **@lexical/code-core, ...**: Remove the extensions deprecated in v0.52.0 and earlier (#9316)
### Behavior changes
...
```
AlessioGr added a commit to payloadcms/payload that referenced this pull request Oct 28, 2026
_Written with AI_

Upgrades  lexical from `0.52.0` to `0.53.0`.

## Breaking changes

Rich-text data keeps its existing format. No database migration is
needed. Payload's built-in features have been updated, but your own
TypeScript code or custom features may need changes:

- **Node type arguments:** `getParent<T>()`, `getParentOrThrow<T>()`,
`getChildren<T>()`, `getFirstChild<T>()`, `getNextSibling<T>()`,
`$getNodeByKey<T>()` and the rest of that family no longer accept a type
argument. Remove `<T>` and narrow the result with a node guard such as
`$isListItemNode`. Runtime behavior is unchanged.
- **Removed extensions:** `LinkImportExtension`, `ListImportExtension`,
`RichTextImportExtension` and `HorizontalRuleImportExtension`
(deprecated in 0.52) are no longer exported from
`@payloadcms/richtext-lexical/lexical/link`, `/list`, `/rich-text` and
`/html`. Use `LinkExtension`, `ListExtension` and `RichTextExtension`;
for horizontal rules, use `HorizontalRuleExtension` from
`@lexical/extension`.
- **Markdown export:** `convertLexicalToMarkdown` escapes literal
brackets and HTML-like text, for example `[note]` becomes
`&#91;note&#93;`, so it is not parsed back as a link or HTML.
`convertMarkdownToLexical` restores the original text.

## Breaking changes and Payload migrations

Reviewed [0.53.0](https://github.com/meta/lexical/releases/tag/v0.53.0)
and the `CHANGELOG.md` now shipped in the `lexical` package, including
its behavior changes. **Yes** means Payload code needed adaptation;
**No** means no Payload migration was required.

| Breaking change | Required migration in Payload | Changes made |
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ----------------------------- |
---------------------------------------------------------------------------------------------------------------------------------------------------
|
| [Unchecked node type arguments are
removed](meta/lexical#9479) from traversal
and key lookup methods. | Yes | `TableCellResizerPlugin` called
`tableRow.getChildren<TableCellNode>()`. It now uses
`.filter($isTableCellNode)`, matching the upstream playground. |
| [Extensions deprecated in 0.52 are
removed](meta/lexical#9316). | No | Payload
does not use them. They disappear from the `export *` proxies listed
above. |
| [`ElementNode.reconcileObservedMutation` restores the committed
children's DOM](meta/lexical#9329)
(`@internal`). | No | No Payload call sites. |
| [`@lexical/mdast` stores table column alignment as cell paragraph
format](meta/lexical#9478). | No | Payload
does not use `@lexical/mdast`. |
| Behavior: [Markdown export escapes literal
text](meta/lexical#9481). | No | Documented
in the migration guide. MDX round-trip int tests pass unchanged. |
| Behavior: [a read-only `ContentEditable` without an accessible name no
longer renders
`role="textbox"`](meta/lexical#9270). | No |
Payload passes the field label as `aria-label`, so labeled read-only
editors keep the role. |
| Behavior: [`ClickableLinkPlugin` opens new tabs without
`window.opener`](meta/lexical#9303), and
[nested editors handle their own link
clicks](meta/lexical#9360). | No | The link
feature uses `ClickableLinkPlugin` and gets the reverse-tabnabbing fix
automatically. |

Package entry points of every proxied package were compared against
0.52.0. The only addition is the experimental
`@lexical/html/BlockIdHTMLExtension` subpath. Payload only re-exports
the `@lexical/html` root, so no proxy exports need adding or removing.

## Previous Lexical upgrades

- [#18397](#18397) — 0.50.0 →
0.52.0
- [#18149](#18149) — 0.48.0 →
0.50.0
- [#17554](#17554) — 0.45.0 →
0.48.0

This branch was successfully deployed

2 active deployments
Preview – lexical — 4e886190 Deployed Oct 27, 2026 by vercel[bot]
Preview – lexical-playground — 4e886190 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants