Portable Text Serialization
sanity-io/agent-toolkitOfficial
Portable Text rendering and serialization across React, Svelte, Vue, Astro, HTML, Markdown, and plain text targets.
- CCM score
- 67 of 100
- skills.sh installs
- 3.2K
- GitHub stars
- 203
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers rendering Portable Text blocks, marks, lists, and custom types across frontend frameworks and server-side outputs
- Includes per-framework rule files for React, Svelte, Vue, Astro, HTML, Markdown, and plain text, plus a table of community serializers
- Requires explicit component mappings for custom types and a stable
componentsobject to avoid re-renders - Designed for developers implementing Portable Text rendering or troubleshooting marks, blocks, and lists in Sanity-backed projects
Install
$ npx -y skills add sanity-io/agent-toolkit --skill portable-text-serialization -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Portable Text Serialization
Render Portable Text content across frameworks using the @portabletext/* library family. Each library follows the same component-mapping pattern: you provide a components object that maps PT node types to framework-specific renderers.
Portable Text Structure (Quick Reference)
PT is an array of blocks. Each block has _type, optional style, children (spans), markDefs, listItem, and level.
Root array
├── block (_type: "block")
│ ├── style: "normal" | "h1" | "h2" | "blockquote" | ...
│ ├── children: [span, span, ...]
│ │ └── span: { _type: "span", text: "...", marks: ["strong", "<markDefKey>"] }
│ ├── markDefs: [{ _key, _type: "link", href: "..." }, ...]
│ ├── listItem: "bullet" | "number" (optional)
│ └── level: 1, 2, 3... (optional, for nested lists)
├── custom block (_type: "image" | "code" | any custom type)
└── ...more blocks
Marks come in two forms:
- Decorators: string values in
marks[]like"strong","em","underline","code" - Annotations: keys in
marks[]referencing entries inmarkDefs[](e.g., links, internal references)
Component Mapping Pattern (All Frameworks)
Details
- Repository
- github.com/sanity-io/agent-toolkit
- Categories
- Frontend & UI Code, Technical Documentation
- First seen
- Jun 3, 2026
More from sanity-io/agent-toolkit
All 7Similar to Portable Text Serialization
More Frontend & UI Codeportable-text-conversionsanity-io/agent-toolkit3.1K installsConvert HTML and Markdown into Portable Text blocks for Sanity during migrations and content pipelines.
sanity-best-practicessanity-io/agent-toolkit36K installsComprehensive Sanity development guidance covering schemas, GROQ, Visual Editing, Studio structure, and framework integrations.
markdown-to-htmlgithub/awesome-copilot10K installsMarkdown-to-HTML conversion guide with marked.js, pandoc, and template system examples covering GFM, CommonMark, and Node.js workflows.
react-emailvercel-labs/json-render1.5K installsRenders JSON element specs into HTML or plain-text emails using React Email components and a custom catalog.
dbs-wechat-htmldontbesilent2025/dbskill21.1K installsTurns a Markdown manuscript into inline-styled WeChat Official Account HTML, with 15 built-in layouts and a preview index page.
hyperframes-coreheygen-com/hyperframes931.5K installsA contract reference for writing HyperFrames composition HTML, timing attributes, and render-safe rules.