mdx-to-lexical

Convert MDX files with custom components to Payload Lexical JSON.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/ComparePower/payload-cms-cloudflare-baseline --skill mdx-to-lexical
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mdx-to-lexical
Source: https://github.com/ComparePower/payload-cms-cloudflare-baseline/tree/main/.claude/skills/mdx-to-lexical
Command: npx skills add https://github.com/ComparePower/payload-cms-cloudflare-baseline --skill mdx-to-lexical

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires unified, remark-parse, remark-mdx, pnpm, and includes scripts (resource) components.

What problem does it solve?

Migrating rich text content from MDX (especially with custom components) to a structured editor format like Payload's Lexical JSON is a complex, manual, and error-prone process. This skill automates the entire conversion, preserving content structure and component functionality.

Core Features & Use Cases

  • Full MDX to Lexical Conversion: Parses MDX, converts Markdown AST to Lexical nodes, extracts inline components, and resolves data instance references to Payload IDs.
  • Component Mapping & Resolution: Intelligently maps custom MDX components to Payload inline blocks and links them to RichTextDataInstances in the database.
  • Use Case: You're migrating a blog from Astro/Keystatic (using MDX with custom components like <FourChangePhoneNumber />) to Payload CMS. Use this skill to convert all MDX content into valid Lexical JSON, ensuring dynamic components function correctly in the new system.

Quick Start

Convert the MDX file 'src/content/articles/my-post.mdx' to Lexical JSON format and save it as 'output/my-post.json'.