您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
One-click (or hotkey) CodePen→Markdown: HTML/CSS/JS fences with optional attribution; raw or compiled output (SCSS→CSS, TS/Babel→JS); customizable shortcut; persistent preferences.
🎯 CodePen.md — Copy as Markdown
Transform any CodePen into beautiful Markdown with one click.Extract HTML, CSS, and JavaScript into clean code fences with proper syntax highlighting and optional attribution.
No more manual copying between editors.
✨ What you get
Example output (click to toggle)
> Source: [Glassmorphism Card by AstroMash](https://codepen.io/astromash/pen/abc123) ```html <div class="glass-card"> <h2>Beautiful Design</h2> </div> ``` ```scss .glass-card { backdrop-filter: blur(20px); background: rgba(17, 24, 39, 0.95); h2 { font-weight: bolder; } } ``` ```javascript const card = document.querySelector('.glass-card'); card.addEventListener('click', () => shimmer()); ```
🚀 Why CodePen.md beats copy-paste
⚡ Instant One click or hotkey — no selecting, no switching editors 🎨 Smart Choose compiled HTML/CSS/JS or raw (selected preprocessor for each editor) with proper language tags 🔗 Attributed Auto-adds title, author, and link in a clean header 🎯 Resilient Works in Preview frame, falls back gracefully, handles clipboard blocks ⌨️ Customizable Set your own shortcut — any combo of CTRL/ALT/SHIFT/CMD + any key 📦 Installation & Usage
Getting started
- Install the userscript (Tampermonkey/Violentmonkey recommended)
- Navigate to any CodePen editor page (
codepen.io/*/pen/*
)- Look for the sleek button combo in the bottom-right corner
- Click Copy CodePen as Markdown or hit Alt+Shift+X
- Paste your perfectly formatted Markdown anywhere
⚙️ Configuration panel
Click the gear icon to reveal a dark-themed options panel:
🔧 Copy Options– Copy compiled code — Get processed output (SCSS→CSS or TS→JS, for example)
– Add attribution header — Include source link with title & author⌨️ Keyboard Shortcut– Enable/disable — Toggle keyboard activation
– Customize combo — Click Edit to set your perfect shortcut
– Visual feedback — See your current combo in a styled badge🎨 Premium Features
- Dark glassmorphism UI — Subtle vibe, smooth flow
- Split button design — Main action + gear for options
- Toast notifications — Clear, non-intrusive feedback
- Collapsible shortcut editor — Compact when closed, full controls when open
- Smart Escape handling — Closes shortcut editor → panel → overlay in order
- Preview frame support — Shortcut works even when preview has focus
- Sync everywhere — Settings persist and sync to preview via
postMessage
🔒 Privacy & Permissions
Zero tracking, pure functionality
No analytics. No network calls. No data collection. Everything runs locally.
Permissions explained:
GM_setClipboard
— Direct clipboard access when allowedGM_notification
— Optional desktop notificationsGM_addStyle
— Injects the UIGM_registerMenuCommand
— Right-click menu optionsunsafeWindow
— Reads CodePen’s editor state💡 Pro Tips
- Windows users: Skip Win (Meta) combos — the OS often intercepts them. Prefer Ctrl/Alt/Shift.
- Preview frame: Your shortcut works there too — the preview asks the parent for the Markdown.
- Language tags: Compiled = standard (
javascript
,css
,html
). Raw = preprocessor (scss
,typescript
).- Clipboard blocked?: A one-click overlay appears to complete the copy.
📋 Compatibility
- Browsers: Chrome, Edge, Firefox (with userscript manager)
- Sites:
codepen.io/*/pen/*
andcdpn.io/*
(preview)🧾 Changelog
2.3.1
- Moved to Github repo
2.3.0
- New compact shortcut editor: collapsed badge row with expandable capture/config.
- Instant preview sync: options & shortcuts broadcast to
cdpn.io
viapostMessage
.- Cleaner labels for special keys (F-keys, arrows, digits).
- Safer clipboard fallback with a one-click overlay.
2.x
- Split copy/gear button, sticky toasts, processed-vs-raw toggle, attribution header toggle.
- Preview-frame hotkey support and a robust parent↔preview messaging bridge.
CodePen.md — Because your code deserves better than screenshots.
Scripted by AstroMash in a fit of copy/paste frustration