Skip to content

Try: edit any HTML as blocks (with DOM parse) - #85524

Draft
ellatrix wants to merge 13 commits into
trunkfrom
try/experiment-dom-b780f0
Draft

ellatrix wants to merge 13 commits into
trunkfrom
try/experiment-dom-b780f0

Conversation

@ellatrix

@ellatrix ellatrix commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

What?

Alternative to #85500.

HTML without block delimiters, like a classic post, opens as blocks instead of one Classic block. Blocks that aren't edited are saved as they were read, and blocks read without delimiters stay without them unless an edit needs one. New blocks get delimiters as before. Unlike #85500, the HTML is read and written with the browser's DOM, not a port of the HTML API.

Why?

So Gutenberg can edit any HTML, like a classic post, without converting it or adding block markup. With the DOM, untouched HTML comes back tidied, but blocks add nothing to it, like extra classes or attributes.

How?

  • HTML outside delimiters is read as blocks by walking the DOM, instead of one Classic block. Elements no block reads become HTML blocks, with the blocks inside them editable.
  • Untouched HTML is saved as the browser writes it. Edited blocks are patched on their element, changing only what the edit changed, and get a delimiter only when reading the HTML back without one would give a different block.
  • Blocks with delimiters keep their exact text.
  • Attributes a block doesn't know are kept in htmlAttributes, shown in the editor and saved again.

Examples of tidying: <P CLASS=tip> becomes <p class="tip">, <br /> becomes <br>, data-x becomes data-x="", and a new attribute is added at the end of the tag.

Testing Instructions

  1. Create a post with HTML without delimiters, for example: wp post create --post_title=Test --post_content='<P CLASS=tip>Hi<br />there</P><section><h3>Title</h3><p>Text</p></section>'.
  2. Open it in the editor and save without changes. The HTML comes back tidied (<p class="tip">Hi<br>there</p>), with no classes added.
  3. Edit the paragraph inside the section and save. Only that text changes, and no delimiters are added.

Testing Instructions for Keyboard

Same as above, typing the edit with the keyboard.

Use of AI Tools

Written with Claude Code (Claude Opus 5.5), reviewed by me.

🤖 Generated with Claude Code

ellatrix and others added 4 commits October 23, 2026 18:48
Behind the "Optional block delimiters" experiment, HTML without block
delimiters opens as blocks and is saved without them where possible.

- Add @wordpress/html-api, a port of the WordPress HTML Tag Processor.
- Read HTML outside delimiters as blocks instead of one Classic block.
  Elements no block reads become HTML blocks, with the blocks inside
  them editable.
- Save untouched blocks exactly as written. Edited blocks change only
  what the edit changed, and get a delimiter only when reading the HTML
  back without one would give a different block.
- Keep attributes a block doesn't know in `htmlAttributes`, show them
  in the editor and save them again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Try the browser's own parser instead of a port of the HTML API. HTML
outside delimiters comes back as the browser writes it (for example
`data-x` becomes `data-x=""`), but blocks still add nothing to it unless
they're edited, and then change only what the edit changed. Delimited
blocks keep their exact text.

Removes @wordpress/html-api.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the [Package] Blocks /packages/blocks label Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: +3.14 kB (+0.04%)

Total Size: 8.56 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 542 kB +435 B (+0.08%)
build/scripts/blocks/index.min.js 47.5 kB +2.7 kB (+6.03%) 🔍

3eca98c Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 66f90f7 trunk % Change
timeToFirstByte 42.35 ms +13.81% -3.19% 43.95 ms +13.77% -4.1% -3.64%
largestContentfulPaint 76 ms +7.89% -10.53% 76 ms +10.53% -5.26% 0%
lcpMinusTtfb 29.35 ms +20.61% -7.16% 29.85 ms +19.43% -5.03% -1.68%
wpBeforeTemplate 21.84 ms +24.5% -1.14% 23.5 ms +17.28% -4.38% -7.06%
wpTemplate 16.63 ms +1.92% -3.49% 17.06 ms +9.03% -3.46% -2.52%
wpTotal 38.92 ms +13.41% -2.93% 40.57 ms +13.7% -4.04% -4.07%
wpMemoryUsage 7.68 MB +0% -0% 7.65 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 66f90f7 trunk % Change
timeToFirstByte 32.15 ms +6.07% -3.73% 35.95 ms +10.85% -2.64% -10.57%
largestContentfulPaint 72 ms +0% -0% 80 ms +7.5% -0% -10%
lcpMinusTtfb 39.7 ms +1.51% -4.41% 44.75 ms +2.91% -1.56% -11.28%
wpBeforeTemplate 19.53 ms +2% -2.36% 19.84 ms +9.48% -2.92% -1.56%
wpTemplate 9.71 ms +4.12% -3.6% 13.51 ms +4.44% -3.77% -28.13%
wpTotal 29.7 ms +5.79% -4.11% 33.2 ms +11.33% -2.47% -10.54%
wpMemoryUsage 6.26 MB +0% -0% 6.34 MB +0% -0% -1.22%
wpDbQueries 9 +0% -0% 13 +0% -0% -30.77%

media-processing

Metric 66f90f7 trunk % Change
mediaProcessingJpeg 322.7 ms +1.1% -0.83% 323.06 ms +1.08% -0.36% -0.11%
mediaProcessingAvif 4798.83 ms +0.22% -0.13% 4813.55 ms +0.4% -0.25% -0.31%
mediaProcessingJpegToAvif 3366.27 ms +0.38% -0.09% 3378.72 ms +0.1% -0.05% -0.37%

media-upload

Metric 66f90f7 trunk % Change
jpegUploadProcessing 1427.87 ms +0.88% -1.03% 1424.35 ms +0.4% -2.04% 0.25%
pngUploadProcessing 186.26 ms +4.21% -3.08% 192.19 ms +58.49% -3.05% -3.09%
largeJpegUploadProcessing 1423.67 ms +1.12% -0.49% 1406.68 ms +0.97% -26.68% 1.21%
multipleImageUploadProcessing 1508.01 ms +2.37% -1.02% 1506.44 ms +0.35% -2.42% 0.1%

post-editor

Metric 66f90f7 trunk % Change
serverResponse 330.5 ms +0.79% -7.96% 337.61 ms +5.21% -6.42% -2.11%
firstPaint 297.15 ms +35.39% -22.45% 420.34 ms +5.26% -19.61% -29.31%
domContentLoaded 678.69 ms +1% -3.37% 750.38 ms +0.6% -5.65% -9.55%
loaded 679.68 ms +1% -3.38% 751.39 ms +0.59% -5.65% -9.54%
firstContentfulPaint 403.7 ms +0.87% -14.32% 434.71 ms +2.12% -6.45% -7.13%
firstBlock 2334.39 ms +0.89% -0.15% 2489.85 ms +1.31% -2.14% -6.24%
type 17.1 ms +4.56% -2.22% 17.57 ms +3.93% -1.71% -2.68%
typeWithoutInspector 14.93 ms +1.94% -1% 18.61 ms +3.44% -4.57% -19.77%
typeWithTopToolbar 20.46 ms +3.57% -10.07% 23.36 ms +4.97% -2.01% -12.41%
typeContainer 7.15 ms +11.75% -6.71% 7.68 ms +2.6% -7.55% -6.9%
focus 92.37 ms +17.56% -3.55% 101.06 ms +8.65% -9.93% -8.6%
firstFocus 184.37 ms +0% -0% 194.27 ms +0% -0% -5.1%
selectAll 371.85 ms +2.43% -0.18% 400.99 ms +2.11% -1.13% -7.27%
listViewOpen 63.71 ms +7.06% -7.91% 56.48 ms +5.74% -6.11% 12.8%
inserterOpen 34.01 ms +10.91% -8.03% 31.47 ms +10.01% -7.82% 8.07%
inserterHover 9.82 ms +10.18% -10.39% 10.23 ms +4.11% -9.19% -4.01%
inserterSearch 7.59 ms +2.64% -12.52% 7.17 ms +3.77% -7.11% 5.86%
loadPatterns 536.3 ms +2.88% -1.49% 492.86 ms +4.94% -2.92% 8.81%
wpTotal 321.58 ms +1.08% -8.31% 329.21 ms +4.89% -6.51% -2.32%
wpMemoryUsage 14.71 MB +0% -0% 14.68 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 66f90f7 trunk % Change
serverResponse 320.64 ms +3.29% -5.58% 311.81 ms +1.62% -5.84% 2.83%
firstPaint 220.8 ms +55.19% -13.93% 218.97 ms +6.55% -24.91% 0.84%
domContentLoaded 683.53 ms +3.07% -2.75% 675.58 ms +1.92% -0.94% 1.18%
loaded 684.29 ms +3.1% -2.72% 676.34 ms +1.92% -0.92% 1.18%
firstContentfulPaint 390.6 ms +2.96% -5.67% 386.73 ms +4.25% -6.24% 1%
firstBlock 3213.77 ms +3.21% -1.54% 3105.22 ms +1.86% -2.69% 3.5%
type 15.45 ms +4.66% -5.95% 15.74 ms +9.53% -7.18% -1.84%
navigate 114.77 ms +14.47% -3.85% 102.51 ms +1.85% -1.48% 11.96%
loadPatterns 1033.92 ms +2.84% -8.96% 938.16 ms +8.63% -3.71% 10.21%
loadPages 1012.28 ms +3.81% -1.64% 1013.33 ms +6.16% -2.8% -0.1%
wpTotal 312.51 ms +3.41% -5.63% 303.85 ms +1.61% -5.97% 2.85%
wpMemoryUsage 12.73 MB +0% -0% 12.70 MB +0% -0% 0.24%
wpDbQueries 44 +2.27% -0% 44 +2.27% -0% 0%

3eca98c Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

List in /test/e2e/specs/editor/blocks/query.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 22
+ Received  +  1

  Array [
    Object {
-     "innerBlocks": Array [
-       Object {
-         "innerBlocks": Array [
-           Object {
-             "name": "core/post-title",
-           },
-           Object {
-             "name": "core/post-featured-image",
-           },
-           Object {
-             "name": "core/post-excerpt",
-           },
-           Object {
-             "name": "core/separator",
-           },
-           Object {
-             "name": "core/post-date",
-           },
-         ],
-         "name": "core/post-template",
-       },
-     ],
+     "innerBlocks": Array [],
      "name": "core/query",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/query.spec.js:88:42
Navigates the items list via UP/DOWN arrow keys (Site Editor v2) in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page One')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByLabel('Page One') with timeout 5000ms
  - waiting for getByLabel('Page One')
    14 × locator resolved to <button type="button" aria-pressed="true" data-active-item="true" id="view-list-0-12-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-12-label" aria-describedby="view-list-0-12-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:149:49
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
can be converted when nested to paragraphs in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:paragraph -->
- <p>one</p>
+ <p>ne</p>
  <!-- /wp:paragraph -->

  <!-- wp:paragraph -->
  <p>two</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:417:52
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
inserts a block in proper place after having clicked `Browse All` from inline inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Add block' })
    - locator resolved to <button type="button" aria-pressed="false" aria-haspopup="true" aria-expanded="false" aria-label="Add block" class="components-button block-editor-inserter__toggle is-next-40px-default-size has-icon">…</button>
  - attempting click action
    - waiting for element to be visible, enabled and stable
  - element was detached from the DOM, retrying

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:557:5
should change the indented list type in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:727:3
should create paragraph on Enter in quote block in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('option', { name: 'List', exact: true })

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:751:67
should create paragraph on split at end and merge back with content in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one</li>
+ <li>e</li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

  <!-- wp:paragraph -->
  <p></p>

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:461:52
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
should format text across blocks in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "ab",
+       "content": "b",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:2219:41
should gradually multi-select in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 3
+ Received  + 7

  Array [
    Object {
-     "name": "core/column",
+     "attributes": Object {
+       "content": "1",
+       "dropCap": false,
      },
-   Object {
-     "name": "core/column",
+     "clientId": "5f7e1504-8fd7-4d72-ad8a-d4022b8963c1",
+     "innerBlocks": Array [],
+     "isValid": true,
+     "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:1200:5
should indent and outdent multi-selected items with Tab in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

@@ -1,8 +1,8 @@
  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>one<!-- wp:list -->
+ <li>ne<!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
  <li>two</li>
  <!-- /wp:list-item -->

  <!-- wp:list-item -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1118:52
should indent with Space and outdent with Shift+Space at the start in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 7
+ Received  + 7

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<!-- wp:list -->
- <ul class="wp-block-list"><!-- wp:list-item -->
- <li>b</li>
+ <li></li>
+ <!-- /wp:list-item --></ul>
- <!-- /wp:list-item --></ul>
+ <!-- /wp:list -->
+
- <!-- /wp:list --></li>
- <!-- /wp:list-item --></ul>
+ <!-- wp:paragraph -->
+ <p> b</p>
- <!-- /wp:list -->
+ <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:875:52
should insert a line break on shift+enter in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 1
+ Received  + 1

  <!-- wp:list -->
  <ul class="wp-block-list"><!-- wp:list-item -->
- <li>a<br></li>
+ <li><br></li>
  <!-- /wp:list-item --></ul>
  <!-- /wp:list -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1210:52
should merge a following sibling list into the outermost list with Delete from a nested item (#77245) in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

@@ -8,11 +8,11 @@
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {
                  "attributes": Object {
-                   "content": "b‸",
+                   "content": "b",
                  },
                  "name": "core/list-item",
                },
              ],
              "name": "core/list",
@@ -25,11 +25,11 @@
    },
    Object {
      "innerBlocks": Array [
        Object {
          "attributes": Object {
-           "content": "1",
+           "content": "‸1",
          },
          "innerBlocks": Array [
            Object {
              "innerBlocks": Array [
                Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:2854:41
should outdent with children in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for locator('role=toolbar[name="Block tools"i]').locator('role=button[name="Indent"]')

    at Editor.clickBlockToolbarButton (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/click-block-toolbar-button.ts:17:15)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/list.spec.js:1055:3
should partially select with shift + click in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  1
+ Received  + 11

  Array [
    Object {
      "attributes": Object {
-       "content": "<strong>1</strong>|2",
+       "content": "<strong>1</strong>[",
+       "dropCap": false,
+     },
+     "innerBlocks": Array [],
+     "name": "core/paragraph",
+   },
+   Object {
+     "attributes": Object {
+       "content": "]2",
+       "dropCap": false,
      },
+     "innerBlocks": Array [],
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:1599:41
should remove an anchored list when deleting its last item in /test/e2e/specs/editor/blocks/list.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

Truncated. See the full report.

3eca98c Run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ellatrix
ellatrix changed the base branch from try/experiment-b780f0 to trunk October 25, 2026 15:15
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Oct 25, 2026
ellatrix and others added 8 commits October 25, 2026 08:27
Inner blocks of a block like List were each read back on their own to
decide whether they need a delimiter. A list item alone isn't a list
item, so editing one saved the whole list with delimiters. Inner blocks
are now read back as part of their parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove the experiment: HTML outside delimiters is always read as blocks,
and blocks that weren't edited are always saved as they were read. New
blocks get delimiters as before.

- Without a DOM or the HTML block, HTML is read and saved as before.
- The current version of a block reads its HTML first, keeping unknown
  attributes in `htmlAttributes`; older versions are tried after.
- Invalid blocks are saved as they were read, and logged as before.
- Pasting HTML outside delimiters goes through raw handling again.
- The full content fixtures check what blocks save, with the source set
  aside; untouched content is checked by the delimiter tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only HTML without delimiters is read for blocks inside it. A delimited
Custom HTML block keeps its static HTML, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A delimited block inside HTML without delimiters, like a paragraph in a
section, used to cut the HTML apart when read, so saving one wrapped the
whole HTML in a Custom HTML block. HTML outside delimiters is now read in
one pass with the delimited blocks in it, which become inner blocks of
an HTML block where they sit inside an element.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Post content is rendered with a parser that reads HTML outside block
delimiters as blocks, the same way the editor does, so render filters
see each block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A block read from an old format, or holding one, is saved in the new
  format, as before.
- Inserted pattern blocks are new blocks, not saved as the pattern file
  is written.
- Whitespace before a removed first block isn't kept.
- New Classic blocks, and new HTML blocks in widget editors, get
  delimiters, so they read back as the same block.

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

dmsnell commented Oct 27, 2026

Copy link
Copy Markdown
Member

data-x becomes data-x=""

This reads the same in the DOM but is a destructive operation. The one is a boolean attribute and the other is an attribute with an empty string as its value. Noting here because this goes beyond tidying and could be seen as a form of corruption. Just a random thought that doesn’t matter much.

@ellatrix

Copy link
Copy Markdown
Member Author

@dmsnell That's what all editors do though, such as ProseMirror and TinyMCE

@dmsnell

dmsnell commented Oct 28, 2026

Copy link
Copy Markdown
Member

@ellatrix any DOM-based system will likely do this. I just noted that distinction and wanted to clarify it as a relevant point.

@ellatrix ellatrix changed the title Try: Experiment (alternative) Try: edit any HTML as blocks (with DOM parse) Nov 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Blocks /packages/blocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants