Adds Markdown fields and blocks to Payload collections, edited in a CodeMirror editor with autocomplete and diagnostics. Content renders on the server with Shiki code highlighting and a directive system for callouts, cards, buttons, tabs and layouts. It also integrates with the official Payload MCP plugin so AI agents can read, validate and edit content as drafts. Works best with Tailwind Typography.
Structured Markdown editing and rendering for Payload CMS with CodeMirror, Shiki, directives, themes, and server-first output.
Installation
npm i @valkyrianlabs/payload-markdown8
Stars
0
Forks
1
Open Issues
5 days ago
Last Updated
864
Weekly Downloads
v1.9.3
npm Version
3.4 MB
Unpacked Size
39
Dependencies
8+1 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 8 |
| Dec 4, 2026 | 8 |
| Dec 3, 2026 | 8 |
| Dec 2, 2026 | 8 |
| Dec 1, 2026 | 8 |
| Nov 30, 2026 | 8 |
| Nov 29, 2026 | 8 |
| Nov 28, 2026 | 8 |
| Nov 27, 2026 | 8 |
| Nov 26, 2026 | 8 |
| Nov 25, 2026 | 8 |
| Nov 24, 2026 | 8 |
| Nov 23, 2026 | 8 |
| Nov 22, 2026 | 8 |
| Nov 21, 2026 | 8 |
| Nov 20, 2026 | 8 |
| Nov 19, 2026 | 8 |
| Nov 18, 2026 | 8 |
| Nov 17, 2026 | 8 |
| Nov 16, 2026 | 8 |
| Nov 15, 2026 | 8 |
| Nov 14, 2026 | 8 |
| Nov 13, 2026 | 8 |
| Nov 12, 2026 | 8 |
| Nov 11, 2026 | 8 |
| Nov 10, 2026 | 8 |
| Nov 9, 2026 | 8 |
| Nov 8, 2026 | 8 |
| Nov 7, 2026 | 8 |
| Nov 6, 2026 | 8 |
| Nov 5, 2026 | 8 |
| Nov 4, 2026 | 8 |
| Nov 3, 2026 | 8 |
| Nov 2, 2026 | 8 |
| Nov 1, 2026 | 8 |
| Oct 31, 2026 | 8 |
| Oct 30, 2026 | 8 |
| Oct 29, 2026 | 8 |
| Oct 28, 2026 | 8 |
| Oct 27, 2026 | 8 |
| Oct 26, 2026 | 8 |
| Oct 25, 2026 | 8 |
| Oct 24, 2026 | 8 |
| Oct 23, 2026 | 8 |
| Oct 22, 2026 | 8 |
| Oct 21, 2026 | 8 |
| Oct 20, 2026 | 8 |
| Oct 19, 2026 | 8 |
| Oct 18, 2026 | 8 |
| Oct 17, 2026 | 8 |
| Oct 16, 2026 | 8 |
| Oct 15, 2026 | 8 |
| Oct 14, 2026 | 8 |
| Oct 13, 2026 | 8 |
| Oct 12, 2026 | 8 |
| Oct 11, 2026 | 8 |
| Oct 10, 2026 | 8 |
| Oct 9, 2026 | 8 |
| Oct 8, 2026 | 8 |
| Oct 7, 2026 | 8 |
| Oct 6, 2026 | 8 |
| Oct 5, 2026 | 8 |
| Oct 4, 2026 | 8 |
| Oct 3, 2026 | 8 |
| Oct 2, 2026 | 7 |
| Oct 1, 2026 | 7 |
| Sep 30, 2026 | 7 |
| Sep 29, 2026 | 7 |
| Sep 28, 2026 | 7 |
| Sep 27, 2026 | 7 |
| Sep 26, 2026 | 7 |
| Sep 25, 2026 | 7 |
| Sep 24, 2026 | 7 |
| Sep 23, 2026 | 7 |
| Sep 22, 2026 | 7 |
| Sep 21, 2026 | 7 |
| Sep 20, 2026 | 7 |
| Sep 19, 2026 | 7 |
| Sep 18, 2026 | 7 |
| Sep 17, 2026 | 7 |
| Sep 16, 2026 | 7 |
| Sep 15, 2026 | 7 |
| Sep 14, 2026 | 7 |
| Sep 13, 2026 | 7 |
| Sep 12, 2026 | 7 |
| Sep 11, 2026 | 7 |
| Sep 10, 2026 | 7 |
| Sep 9, 2026 | 7 |
| Sep 8, 2026 | 7 |
| Sep 7, 2026 | 7 |
| Sep 6, 2026 | 7 |
833+803 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 833 |
| Dec 4, 2026 | 785 |
| Dec 3, 2026 | 757 |
| Dec 2, 2026 | 717 |
| Dec 1, 2026 | 386 |
| Nov 30, 2026 | 43 |
| Nov 29, 2026 | 42 |
| Nov 28, 2026 | 39 |
| Nov 27, 2026 | 57 |
| Nov 26, 2026 | 55 |
| Nov 25, 2026 | 49 |
| Nov 24, 2026 | 43 |
| Nov 23, 2026 | 56 |
| Nov 22, 2026 | 62 |
| Nov 21, 2026 | 62 |
| Nov 20, 2026 | 57 |
| Nov 19, 2026 | 55 |
| Nov 18, 2026 | 59 |
| Nov 17, 2026 | 61 |
| Nov 16, 2026 | 50 |
| Nov 15, 2026 | 45 |
| Nov 14, 2026 | 43 |
| Nov 13, 2026 | 30 |
| Nov 12, 2026 | 29 |
| Nov 11, 2026 | 17 |
| Nov 10, 2026 | 16 |
| Nov 9, 2026 | 26 |
| Nov 8, 2026 | 24 |
| Nov 7, 2026 | 25 |
| Nov 6, 2026 | 31 |
| Nov 5, 2026 | 36 |
| Nov 4, 2026 | 44 |
| Nov 3, 2026 | 90 |
| Nov 2, 2026 | 79 |
| Nov 1, 2026 | 85 |
| Oct 31, 2026 | 89 |
| Oct 30, 2026 | 110 |
| Oct 29, 2026 | 104 |
| Oct 28, 2026 | 96 |
| Oct 27, 2026 | 59 |
| Oct 26, 2026 | 74 |
| Oct 25, 2026 | 77 |
| Oct 24, 2026 | 102 |
| Oct 23, 2026 | 71 |
| Oct 22, 2026 | 215 |
| Oct 21, 2026 | 228 |
| Oct 20, 2026 | 225 |
| Oct 19, 2026 | 215 |
| Oct 18, 2026 | 225 |
| Oct 17, 2026 | 378 |
| Oct 16, 2026 | 385 |
| Oct 15, 2026 | 296 |
| Oct 14, 2026 | 470 |
| Oct 13, 2026 | 486 |
| Oct 12, 2026 | 529 |
| Oct 11, 2026 | 685 |
| Oct 10, 2026 | 506 |
| Oct 9, 2026 | 501 |
| Oct 8, 2026 | 448 |
| Oct 7, 2026 | 261 |
| Oct 6, 2026 | 236 |
| Oct 5, 2026 | 186 |
| Oct 4, 2026 | 9 |
| Oct 3, 2026 | 12 |
| Oct 2, 2026 | 16 |
| Oct 1, 2026 | 14 |
| Sep 30, 2026 | 19 |
| Sep 29, 2026 | 19 |
| Sep 28, 2026 | 19 |
| Sep 27, 2026 | 19 |
| Sep 26, 2026 | 22 |
| Sep 25, 2026 | 18 |
| Sep 24, 2026 | 20 |
| Sep 23, 2026 | 15 |
| Sep 22, 2026 | 16 |
| Sep 21, 2026 | 28 |
| Sep 20, 2026 | 32 |
| Sep 19, 2026 | 29 |
| Sep 18, 2026 | 39 |
| Sep 17, 2026 | 37 |
| Sep 16, 2026 | 46 |
| Sep 15, 2026 | 45 |
| Sep 14, 2026 | 48 |
| Sep 13, 2026 | 59 |
| Sep 12, 2026 | 68 |
| Sep 11, 2026 | 59 |
| Sep 10, 2026 | 59 |
| Sep 9, 2026 | 50 |
| Sep 8, 2026 | 53 |
| Sep 7, 2026 | 40 |
| Sep 6, 2026 | 30 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1197676810-root)<a href="https://payloaddirectory.dev/plugins/1197676810-root"><img src="https://payloaddirectory.dev/badge/1197676810-root.svg" alt="Payload Directory"></a>README
@valkyrianlabs/payload-markdown
Structured Markdown editing and rendering for Payload CMS.
payload-markdown gives Payload a Markdown-first authoring system with a CodeMirror editor, Shiki-powered code blocks, registry-backed directives, local SVG icon packs, buttons, cards, table-of-contents generation, autocomplete, diagnostics, and server-first rendering.
No bloated rich text editor.
No JSON-shaped content prison.
No MDX ceremony for common docs/blog layouts.
Just portable Markdown that renders like a real system.
Payload Markdown now feels much closer to a Markdown-native design system: readable [Title] directive labels, expanded multiline args, local icon packs, button primitives, smarter autocomplete, richer card linking, and editor readability aids without giving up portable Markdown.
New in v1.7: AI agents can manage your content. Connect Claude, Cursor, or any MCP client to your Payload app and ask for changes in plain language.
pnpm add payload-markdown
[!IMPORTANT] Install the agent skill. If you use Payload MCP or let AI agents (Claude Code, Codex) work in your repo, install the skill that ships with the package so they know every directive, theme and the MCP workflow:
npx payload-markdown skill installRun it again after upgrading.
npx payload-markdown skill checkfails when the installed skill has drifted from the package, and agents are told to suggest the update when they notice.
payload-markdown is also published as @valkyrianlabs/payload-markdown: the same package, built once and released at the same version, and still fully supported. Import from whichever name you installed (@valkyrianlabs/payload-markdown/server instead of payload-markdown/server, and so on), and install only one of them.
"Rewrite the Home page from our launch post. Use cards for the features and add an FAQ after the hero."
Say that to Claude, Cursor, or any MCP client, and it gets done. The agent finds the page, writes payload-markdown using the directives, themes, icons, and code languages your site actually has, validates every block with your renderer, and saves a draft for you to review in the admin.
payload-markdown/mcp plugs into Payload's official @payloadcms/plugin-mcp:
import { mcpPlugin } from '@payloadcms/plugin-mcp'
import { payloadMarkdown } from 'payload-markdown'
import { withPayloadMarkdownMcp } from 'payload-markdown/mcp'
export default buildConfig({
plugins: [
payloadMarkdown({ collections: { pages: true, posts: true } }),
mcpPlugin(
withPayloadMarkdownMcp({
collections: { pages: { enabled: true }, posts: { enabled: true } },
}),
),
],
})
Create an API key in the admin (MCP → API Keys), then connect your agent:
claude mcp add --transport http payload http://localhost:3000/api/mcp \
--header "Authorization: Bearer <key>"
| Tool | What the agent gets |
|---|---|
markdownGuide | A site-aware authoring guide, generated live from your config: where markdown lives, your themes, icons, and code languages, every directive and attribute. |
markdownRead | Find documents by id, title, slug, or query and see every markdown field and block with stable refs. |
markdownValidate | Render-exact validation with line and column diagnostics. |
markdownWrite | Atomic replace, insert, and remove edits. Validated first, saved as a draft, other blocks untouched. |
markdownPublish | Publish the draft, only when you ask. |
Built to be trusted with a real site:
ifUpdatedAt refuses stale writes, and open (locked) documents are respected.The package also ships an agent skill so Claude Code and Codex know the workflow out of the box: npx payload-markdown skill install (see Install).
Full setup, directive syntax, theme configuration, code block options, editor behavior, and migration notes live in the docs.
Most CMS content systems eventually force you into one of two weak paths:
This plugin takes the third path:
Write fast. Render clean. Stay in control.
::button leaf directives and :::buttons groups@pack/namelinkScope and newTab controls for card and cards layoutsPayload Markdown directive preview
payload-markdown renders structured Markdown directly inside the Payload admin preview, including callouts, details, TOCs, steps, cards, buttons, tabs, themes, icons, and code blocks — without turning your content into JSON-shaped sludge.
New examples prefer labels for visible titles and expanded attrs for anything non-trivial:
:::card[Fast Setup]{
href="/getting-started/installation"
linkScope="title"
icon="@fa-duotone/bolt"
}
Install, configure, ship.
:::buttons{
align="center"
stack="mobile"
gap="md"
}
::button[Read Docs]{
href="/docs"
variant="primary"
icon="@fa-duotone/book-open"
}
::button[GitHub]{
href="https://github.com/valkyrianlabs/payload-markdown"
variant="secondary"
icon="@brand/github"
newTab=true
}
:::
:::
The older title="" form remains compatible, but [Title] keeps visible content out of the argument list. Card and cards directives support scoped linking through linkScope; use linkScope="title" when a card body contains buttons or links.
Editor completion can expose shortcuts such as ::button, ::button_icon, and ::button_full, but generated Markdown always uses the canonical ::button directive. Syntax highlighting now distinguishes directive names, labels, arg names, arg values, and leaf-vs-container directives, while closing labels make nested ::: blocks easier to scan.
Payload Markdown supports structured directives for real content layouts:
:::callout:::details:::toc:::steps:::cards:::card::button:::buttons:::tabs:::tab:::section:::2col:::3col:::cellDirectives are plain Markdown. They stay readable in Git, easy to review in PRs, and simple for AI/editor tooling to maintain.
See the docs for directive syntax, supported attributes, nesting behavior, themes, and examples:
Directive themes are first-class.
Themes live beside config, not inside it. Theme objects use classes, not className.
Default themes are included automatically. You only define custom themes when you want to extend or override the built-ins.
Themes can be configured globally or scoped per collection, then selected directly from Markdown using directive attributes.
Stable classes and data attributes are emitted for overrides, including data-directive, data-theme, and vl-md-* hook classes.
Palettes are named colour themes that colour individual icons and recolour directives, on top of their structural theme:
:::card[Linux]{icon="@fa-brands/debian palette=debian, @fa-brands/ubuntu palette=ubuntu" theme="glass"}
Debian and Ubuntu support.
:::
Each icon carries its own palette, so order never swaps colours. Palettes paint the SVG itself (brand icons, duotone layers, explicit fills), follow light and dark mode, and come built in for every Tailwind hue. Define more in code, or enable appearance: true to manage them in the admin and over MCP at runtime, without CSS or a rebuild.
Code block rendering has its own top-level code namespace.
Use it to configure Shiki languages, the Shiki theme, line numbers, enhanced rendering, and full-bleed code behavior.
Legacy config.options still works, but code is the preferred API.
Migration mapping:
config.options.langs → code.langsconfig.options.lineNumbers → code.lineNumbersconfig.options.theme → code.shikiThemeconfig.options.enhancedCodeBlocks → code.enhancedconfig.fullBleedCode → code.fullBleedRegister the plugin in your Payload config, enable it for one or more collections, then render Markdown content with the server renderer.
The full setup guide covers:
The editor is built on CodeMirror and includes:
::button_iconThe goal is simple: author Markdown like text, but get enough tooling that complex docs stay pleasant.
For best rendering defaults, enable Tailwind Typography and scan the plugin output.
Required pieces:
@tailwindcss/typographydist directory to Tailwind sources@custom-variant dark so the Markdown output follows itTheme class strings defined in your app config should also live in scanned source files.
Runtime arbitrary Tailwind classes inside CMS-authored Markdown are not the recommended styling path. Use directive theme="..." values and configure named themes in source.
Use one Markdown field to author:
The content stays readable in Git and editable in Payload.
If that aligns with how you build, this will feel right.
ox payload editorial
Editorial Lexical blocks written as markdown directives, with lossless round trip and token-styled rendering
250v3 v4
payload shiki code
Server-rendered Shiki syntax-highlighted code block for Payload Lexical richtext fields
372.2k/wk3v3
payload callouts
Callout block for the Lexical editor with GitHub and Obsidian themes and server-rendered output
238/wk1v3
richtext
Rich-text child block, default Lexical editor preset and JSX renderer for Atomic Payload
6433/wk37v3
payload paste as markdown
Lexical editor feature for pasting raw Markdown through a toolbar button, slash command, or drawer
631.2k/wk0v3
payload plugin lexical
Lexical-based rich text editor field for Payload 1.x with tables, embeds, and a customizable feature set
35152/wk213v1