Skip to content

feat: extract @portabletext/html package from block-tools#2225

Closed
christianhg wants to merge 1 commit intomainfrom
feat/html-package
Closed

feat: extract @portabletext/html package from block-tools#2225
christianhg wants to merge 1 commit intomainfrom
feat/html-package

Conversation

@christianhg
Copy link
Copy Markdown
Member

@christianhg christianhg commented Feb 20, 2026

Extract HTML-to-Portable Text conversion from @portabletext/block-tools into a new @portabletext/html package, mirroring the @portabletext/markdown API.

Block-tools has always been a thin wrapper around code that does not depend on @sanity/* types. This makes that split explicit: the new package owns the deserializer, rules, preprocessors, and all tests. Block-tools becomes a ~50-line legacy adapter that converts ArraySchemaType to Schema and delegates.

Changes:

  • New @portabletext/html package with htmlToPortableText(html, options?). Schema moves from positional arg into options. unstable_whitespaceOnPasteMode renamed to whitespace.
  • @portabletext/block-tools gutted to adapter: preserves htmlToBlocks signature, re-exports from html package.
  • Editor converters (converter.text-html.ts, converter.text-plain.ts) import from @portabletext/html directly.
  • HtmlDeserializer tests rewritten to use defineSchema/compileSchema from @portabletext/schema instead of Sanity schema fixtures.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 20, 2026

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

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Feb 24, 2026 2:22pm
portable-text-example-basic Ready Ready Preview, Comment Feb 24, 2026 2:22pm
portable-text-playground Error Error Feb 24, 2026 2:22pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: a91b27e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@portabletext/html Minor
@portabletext/block-tools Minor
@portabletext/editor Patch
@portabletext/plugin-character-pair-decorator Patch
@portabletext/plugin-emoji-picker Patch
@portabletext/plugin-input-rule Patch
@portabletext/plugin-markdown-shortcuts Patch
@portabletext/plugin-one-line Patch
@portabletext/plugin-paste-link Patch
@portabletext/plugin-sdk-value Patch
@portabletext/plugin-typeahead-picker Patch
@portabletext/plugin-typography Patch
@portabletext/toolbar Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel vercel Bot temporarily deployed to Preview – portable-text-editor-documentation February 20, 2026 14:09 Inactive
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Feb 24, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

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.

1 participant