Skip to content

Content Resizing: Preserve inline HTML - #915

Open
yogeshbhutkar wants to merge 1 commit into
WordPress:developfrom
yogeshbhutkar:fix/content-resizing-html-support
Open

Content Resizing: Preserve inline HTML#915
yogeshbhutkar wants to merge 1 commit into
WordPress:developfrom
yogeshbhutkar:fix/content-resizing-html-support

Conversation

@yogeshbhutkar

@yogeshbhutkar yogeshbhutkar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What, Why, and How?

This PR enables preserving inline HTML in content resizing, ensuring links, emphasis, code, and other inline formatting survive the AI transformation.

The documentation and system prompts indicate that the experiment preserves inline HTML; however, this did not happen because the toolbar used the getBlockText helper. This PR replaces it with the shared getBlockHTML utility so formatted content is sent to the content-resizing ability with its inline markup intact.

Ref:

The Content Resizing experiment lets editors transform the content of an individual block in three ways — **Shorten**, **Expand**, or **Rephrase** — directly from the block toolbar. The experiment registers a WordPress Ability (`ai/content-resizing`) that returns the transformed text while preserving inline HTML (links, emphasis, code, etc.). The ability can be called both through the in-editor UI and directly via REST API for automation.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.6 Sol
Used for: Code review

Testing Instructions

  1. Enable the Content Resizing experiment and configure an AI provider.
  2. Create a post with a paragraph containing inline formatting, such as a link, bold, italic, and inline code.
  3. Select the paragraph and choose Resize Content → Rephrase.
  4. Verify the original and suggested content retain the inline formatting.
  5. Accept the suggestion and confirm the formatting remains intact in the editor and after saving/reloading the post.

Screencast

Before

before-bug.mov

After

after-fix.mov

Changelog Entry

Fixed - Preserve inline HTML when resizing content.

Open WordPress Playground Preview

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.43%. Comparing base (5599e9d) to head (ffbf4b4).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #915   +/-   ##
==========================================
  Coverage      80.43%   80.43%           
  Complexity      2565     2565           
==========================================
  Files            110      110           
  Lines          10448    10448           
==========================================
  Hits            8404     8404           
  Misses          2044     2044           
Flag Coverage Δ
unit 80.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yogeshbhutkar
yogeshbhutkar marked this pull request as ready for review August 3, 2026 06:10
@yogeshbhutkar
yogeshbhutkar requested a review from a team August 3, 2026 06:10
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dkotter dkotter added this to the 1.3.0 milestone Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants