DEV Community

Matt Cretzman
Matt Cretzman

Posted on • Originally published at mattcretzman.com

My Content Pipeline Broke on Day Two. Here's What I Built to Make It Unbreakable.

If you're automating Substack, Medium, Notion, or any ProseMirror-based editor with Playwright, you've probably hit this: keyboard.type() produces raw markdown characters instead of formatted text.

[link text](https://url) shows up as literal square brackets. 1. triggers an auto-formatted list. **bold** stays as asterisks.

The fix is six lines.

The Problem

Rich text editors like ProseMirror don't parse markdown on keyboard input. When you call page.keyboard.type('[text](url)'), the editor receives individual keystrokes. It has no idea you meant a hyperlink.

Medium's editor is worse — it watches for formatting triggers. Type 1. at the start of a line and it auto-converts to an ordered list. Type - and you get bullets. Character-by-character input fires every trigger.

The Fix: HTML Clipboard Paste

ProseMirror (and Medium, and most contenteditable editors) do interpret HTML — but only on paste operations via ClipboardEvent.

Top comments (0)