Paste as Markdown

Lexical editor feature that lets authors paste raw Markdown into Payload's rich-text editor via toolbar, slash command, or drawer.

Community 0 386/wk MIT v0.1.2

Installation

pnpm add payload-paste-as-markdown

About

Paste as Markdown is a Lexical editor feature for Payload 3.x that gives authors a way to drop raw Markdown into the rich-text editor. It adds a toolbar button to both the fixed and inline toolbars, a slash-menu item that matches /markdown, /md, and /paste, and a modal drawer containing a monospace textarea. The author pastes Markdown, confirms, and the converted nodes land at the exact cursor position, splitting the current paragraph when needed. It is not a top-level buildConfig plugin. You add MarkdownPasteFeature() to the features array of a lexicalEditor inside any richText field, then regenerate the import map with npx payload generate:importmap. The server feature registers a client feature string that Payload resolves through the import map, and the client feature wires up a Lexical plugin, the toolbar groups, and the slash-menu group. Conversion relies on Lexical's built-in markdown transformers, pulled from editorConfig.features.markdownTransformers. The insertion routine saves the current selection and root children, converts the Markdown in place to read the resulting nodes, restores the original content, then inserts those converted nodes at the saved cursor offset and moves the caret to the end of the inserted content. The package is pure client code with no backend. It targets Payload 3.x and React 19.x through peer dependencies, and is not compatible with Payload 2.x. The drawer is a manual React portal rather than Payload's native drawer component, so it does not pick up Payload's standard drawer affordances.

Package info

Package name
payload-paste-as-markdown
Latest version
0.1.2
Unpacked size
20 kB
License
MIT
Weekly downloads
386
Last publish
Aug 25, 2026

Similar plugins

More in Editor