Portable Text Conversion
sanity-io/agent-toolkitOfficial
Convert HTML and Markdown into Portable Text blocks for Sanity during migrations and content pipelines.
- CCM score
- 71 of 100
- skills.sh installs
- 3.1K
- GitHub stars
- 203
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers three conversion paths:
markdownToPortableTextfor Markdown,htmlToBlocksfor HTML, and manual block construction from any source - Includes the Portable Text block structure, with required
_keyfields,markDefs, andlistItemandlevelfor lists - Provides separate rule files for Markdown, HTML, and manual construction, each covering its own conversion behavior
- Designed for teams migrating content from legacy CMSs or building pipelines that ingest external content into Sanity
Install
$ npx -y skills add sanity-io/agent-toolkit --skill portable-text-conversion -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Portable Text Conversion
Convert external content (HTML, Markdown) into Portable Text for Sanity. Three main approaches:
markdownToPortableText— Convert Markdown directly using@portabletext/markdown(recommended for Markdown)htmlToBlocks— Parse HTML into PT blocks using@portabletext/block-tools(for HTML migration)- Manual construction — Build PT blocks directly from any source (APIs, databases, etc.)
Portable Text Specification
Understand the target format before converting. PT is an array of blocks:
[
{
"_type": "block",
"_key": "abc123",
"style": "normal",
"children": [
{"_type": "span", "_key": "def456", "text": "Hello ", "marks": []},
{"_type": "span", "_key": "ghi789", "text": "world", "marks": ["strong"]}
],
"markDefs": []
},
{
"_type": "block",
"_key": "jkl012",
"style": "h2",
"children": [
{"_type": "span", "_key": "mno345", "text": "A heading", "marks": []}
],
"markDefs": []
},
{
"_type": "image",
"_key": "pqr678",
"asset": {"_type": "reference", "_ref": "image-abc-200x200-png"}
}
]
Details
- Repository
- github.com/sanity-io/agent-toolkit
- Category
- Backend & APIs
- First seen
- Jun 3, 2026
More from sanity-io/agent-toolkit
All 7Similar to Portable Text Conversion
More Backend & APIsportable-text-serializationsanity-io/agent-toolkit3.2K installsPortable Text rendering and serialization across React, Svelte, Vue, Astro, HTML, Markdown, and plain text targets.
sanity-migrationsanity-io/agent-toolkit25.5K installsPlans, implements, and reviews migrations from AEM, Contentful, WordPress, Drupal, Markdown, and other systems into Sanity.
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.
markitdownk-dense-ai/scientific-agent-skills2.5K installsConvert heterogeneous documents to Markdown for search and LLM ingestion using Microsoft MarkItDown 0.1.8.
markitdown-skilljulianobarbosa/claude-code-skills252 installsConverter that turns documents, media, web pages, and data files into Markdown for LLM pipelines.