Portable Text is an open specification for structured block content. Rich text, images, code blocks, and any custom type you define, stored as JSON and renderable anywhere.
This monorepo contains @portabletext/editor, the officially supported editor for working with Portable Text content. It's a headless, schema-driven block content editor for React: you bring the UI, the editor handles the editing. The other packages in this repository support editor work, including schema definition, toolbar hooks, plugins, conversion to and from HTML and Markdown, and testing utilities.
Looking to render Portable Text? The renderers (
@portabletext/react,@portabletext/to-html, and friends) live in separate repositories. See Render Portable Text for the full picture.
For documentation and guides, visit portabletext.org. To try the editor, head to the Portable Text Playground.
| Package | Description |
|---|---|
@portabletext/editor |
The official editor for editing Portable Text |
@portabletext/schema |
Define and compile Portable Text schemas with full type safety |
@portabletext/toolbar |
React hooks for building toolbars and related UI components |
| Package | Description |
|---|---|
@portabletext/plugin-character-pair-decorator |
Automatically match a pair of characters and decorate the text in between |
@portabletext/plugin-dnd |
Track the drop position during drag and drop for custom drop indicators |
@portabletext/plugin-emoji-picker |
Easily configure an Emoji Picker for the Portable Text Editor |
@portabletext/plugin-input-rule |
Easily configure Input Rules in the Portable Text Editor |
@portabletext/plugin-list-index |
Compute the list index of each list item for custom list rendering |
@portabletext/plugin-markdown-shortcuts |
Add helpful Markdown shortcuts to the editor |
@portabletext/plugin-one-line |
Restrict the Portable Text Editor to a single line |
@portabletext/plugin-paste-link |
Allow pasting links in the Portable Text Editor |
@portabletext/plugin-sdk-value |
Connect a Portable Text Editor with a Sanity document using the SDK |
@portabletext/plugin-typeahead-picker |
Build typeahead pickers (emoji, mentions, slash commands) |
@portabletext/plugin-typography |
Automatically transform text to typographic variants |
| Package | Description |
|---|---|
@portabletext/html |
Convert HTML to Portable Text |
@portabletext/block-tools |
Sanity-flavored HTML to Portable Text (wraps @portabletext/html) |
@portabletext/markdown |
Convert Portable Text to Markdown and back again |
@portabletext/keyboard-shortcuts |
Platform-aware keyboard shortcuts |
@portabletext/sanity-bridge |
Convert between Sanity schemas and Portable Text schemas |
@portabletext/patches |
Apply Sanity patches to a value |
@portabletext/test |
Testing utilities for the Portable Text Editor |
racejar |
A testing framework agnostic Gherkin driver |
This is a pnpm and Turborepo monorepo.
pnpm install # install dependencies
pnpm build # build every packageRun pnpm test for the test suites and pnpm check:types, pnpm check:lint, and pnpm check:format for the checks CI runs.