subagentceo/knowledge-engineering/sanity-plugin-portable-text-conversion
Claude Code and agent skill by subagentceo/knowledge-engineering
- community
Checking that the SKILL.md file is still in the repository.
Convert HTML and Markdown content into Portable Text blocks for Sanity. Use when migrating content from legacy CMSs, importing HTML or Markdown into Sanity, building content pipelines that ingest external content, converting rich text between formats, or programmatically creating Portable Text documents. Covers @portabletext/markdown (markdownToPortableText), @portabletext/block-tools (htmlToBlocks), custom deserializers, and the Portable Text specification for manual block construction.
Install
npx vskill@latest install subagentceo/knowledge-engineering/sanity-plugin-portable-text-conversionSKILL.md
The same SKILL.md was published earlier as subagentceo/knowledge-engineering/sanity-plugin-portable-text-conversion.
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:
Key rules:
- Every block and span needs
_key(unique within the array) _type: "block"is for text blocks; custom types use their own_typemarkDefsholds annotation data;markson spans referencemarkDefs[*]._keyor are decorator strings- Lists use
listItem("bullet" | "number") andlevel(1, 2, 3...) on regular blocks
Conversion Rules
Read the rule file matching your source format:
- Markdown → Portable Text:
rules/markdown-to-pt.md—@portabletext/markdownwithmarkdownToPortableText(recommended) - HTML → Portable Text:
rules/html-to-pt.md—@portabletext/block-toolswithhtmlToBlocks - Manual PT Construction:
rules/manual-construction.md— build blocks programmatically from any source
Note:@sanity/block-toolsis the legacy package name. Always use@portabletext/block-toolsfor new projects. The API is the same.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcowork/skills/plugins/sanity-plugin:portable-text-conversion/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/subagentceo/knowledge-engineering/sanity-plugin-portable-text-conversion)