markdown-preview
БесплатноБез исполняемых скриптовНе проверенGenerate browser-viewable HTML previews from markdown, plain text, and Mermaid diagrams. Auto-validates, styles, and opens in browser.
Об этом скилле
Markdown Preview Generator — Browser-Ready HTML from Markdown
Generate self-contained HTML files from markdown content and automatically open them in the user's default browser.
What This Skill Does
- Accepts GitHub-flavored markdown, plain text, and Mermaid diagrams
- Validates all Mermaid diagrams in document at once (single validation pass)
- Generates single-page HTML with embedded libraries (marked.js, Prism.js, Mermaid.js)
- Applies professional styling (GitHub-style, dark mode, or minimal)
- Saves HTML to system temp directory with unique filename
- Auto-opens preview in default browser (cross-platform: macOS, Linux, Windows)
- Returns file path and execution status
When to Use
Use this skill when you need to:
- Preview markdown documentation in a browser
- Visualize Mermaid diagrams with proper rendering
- Generate formatted HTML reports for users
- Display code blocks with syntax highlighting
- Create professional previews of generated content
Trigger scenarios: markdown preview, HTML generation, browser preview, document visualization, diagram rendering.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| content | string | Yes | - | Markdown, plain text, or Mermaid content to render |
| title | string | No | "Markdown Preview" | HTML page title |
| theme | string | No | "github" | Template theme: "github", "dark", or "minimal" |
Workflow
1. Parse Input Content
Extract content from agent context or parameters. The skill expects markdown content as a string input.
2. Validate All Mermaid Diagrams (Single Pass)
Efficient Validation Strategy:
Instead of validating each diagram individually, validate the entire markdown document at once:
Write markdown to temp file:
TEMP_MD=$(mktemp /tmp/markdown-preview.XXXXXX.md) echo "$CONTENT" > "$TEMP_MD"Validate all diagrams in one pass:
rp1 agent-tools mmd-validate "$TEMP_MD" EXIT_CODE=$?Check validation result:
- If
EXIT_CODE = 0: All diagrams valid, proceed with generation - If
EXIT_CODE = 1: One or more diagrams invalid
- If
Handle validation failures:
if [ $EXIT_CODE -ne 0 ]; then # Extract error message from validation output # Prepend warning to markdown content: CONTENT="⚠️ **Mermaid Validation Warning**: Some diagrams have syntax errors. They may not render correctly in the preview.\n\n$CONTENT" # Continue with HTML generation (non-blocking) fiClean up temp file:
rm -f "$TEMP_MD"
Why This Approach is Better:
- ✅ Single validation pass instead of per-diagram validation
- ✅ Faster: Validates all diagrams in ~2-5 seconds total (not per diagram)
- ✅ Uses CLI tool: Leverages
rp1 agent-tools mmd-validatefor validation - ✅ Simpler logic: No loops, no retry attempts
- ✅ Non-blocking errors: Invalid diagrams show in preview with Mermaid's own error rendering
- ✅ Better user experience: User sees actual diagram syntax errors in browser
Error Handling:
- Validation failures are non-blocking (HTML generation continues)
- Invalid diagrams render with Mermaid.js's built-in error display
- User can see exact syntax errors in browser preview
- Warning message prepended to document if validation fails
Dependencies:
- Requires rp1 CLI v0.3.0+ (includes
agent-tools mmd-validatecommand) - CLI tool supports markdown files with multiple Mermaid blocks
3. Generate Self-Contained HTML
Template Selection:
Based on theme parameter, select appropriate template from TEMPLATES.md:
- "github" (default): GitHub-style with professional appearance
- "dark": Dark mode for late-night work or presentations
- "minimal": Lightweight, print-friendly styling
Template Loading:
- Read selected template from TEMPLATES.md
- Identify template section markers
- Extract complete HTML template
Template Processing:
- Replace
{{TITLE}}with actual page title - Replace
{{MARKDOWN_CONTENT}}with markdown content - Ensure proper escaping of special characters in content
HTML Features (embedded in templates):
- Libraries: marked.js (markdown), Prism.js (syntax highlighting), Mermaid.js (diagrams)
- Security: Content Security Policy prevents XSS attacks
- Styling: Professional CSS embedded inline
- Rendering: Client-side JavaScript handles markdown parsing and diagram rendering
- Error Display: Mermaid.js automatically shows syntax errors for invalid diagrams
- Languages: Syntax highlighting for 10+ languages (Python, JavaScript, TypeScript, Bash, JSON, YAML, Rust, Go, Java, Markdown)
See TEMPLATES.md for complete HTML structure and styling details.
4. Write HTML to Temp Directory
Filename Generation:
TIMESTAMP=$(date +%s%N)
FILENAME="markdown-preview-$TIMESTAMP.html"
TEM
Установить markdown-preview в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteBashSkillВложенные файлы
FAQ
Что делает скилл markdown-preview?
Generate browser-viewable HTML previews from markdown, plain text, and Mermaid diagrams. Auto-validates, styles, and opens in browser.
Как установить скилл markdown-preview?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл markdown-preview запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic