wp-block-markup
БесплатноБез исполняемых скриптовНе проверенWordPress block markup syntax and HTML structure. Understand block delimiters, attributes, nesting, and how blocks serialize to the database. Based on…
от wpgaurav★ 24 звезды на GitHubОб этом скилле
WordPress Block Markup Syntax
When to Use
Use this skill when:
- Writing raw block markup for patterns, templates, or REST API content pushes
- Debugging block validation errors ("Block contains unexpected content")
- Converting HTML to block format programmatically
- Working with block templates in PHP
- Understanding how blocks serialize to
post_content
Block Grammar
WordPress blocks use HTML comments as delimiters. The content between comments is valid HTML that the parser reconstructs on load.
Three Block Forms
<!-- 1. Balanced block (opening + closing) -->
<!-- wp:paragraph -->
<p>Content here.</p>
<!-- /wp:paragraph -->
<!-- 2. Self-closing / void block (no inner HTML) -->
<!-- wp:latest-posts {"postsToShow":5} /-->
<!-- 3. Balanced block with attributes -->
<!-- wp:image {"id":123,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large">
<img src="image.jpg" alt="" class="wp-image-123"/>
</figure>
<!-- /wp:image -->
Naming Rules
Core blocks omit the namespace. Custom blocks require one.
<!-- wp:paragraph --> ✓ Core block (no namespace)
<!-- wp:core/paragraph --> ✗ Never use core/ prefix
<!-- wp:acf/callout --> ✓ Custom block with namespace
Attribute Serialization
Two Storage Locations
Block attributes are stored in two places, not one:
| Location | What Goes Here | Example |
|---|---|---|
| Comment JSON | Values not derivable from HTML: IDs, booleans, enums, style objects, layout config | {"id":123,"sizeSlug":"large"} |
| HTML content | Values sourced from the DOM: text content, src, href, alt, CSS classes |
<img src="..." alt="..."/> |
The block's block.json defines which attributes go where via the source property:
source: (none) → stored in comment JSON
source: "attribute"→ read from HTML element attribute (src, href, alt, etc.)
source: "html" → read from element innerHTML
source: "text" → read from element textContent
JSON Format Rules
<!-- wp:image {"id":123,"sizeSlug":"large","linkDestination":"media"} -->
- Valid JSON object (double quotes, no trailing commas)
- Compact format: no spaces after colons or commas (
{"key":"val"}not{ "key" : "val" }) - Omit attributes with default values (keeps markup clean)
- Attribute order doesn't matter
- Must be single line (no line breaks in JSON)
Common Attribute Patterns
Colors (palette preset):
{"backgroundColor":"primary","textColor":"white"}
Produces: class="has-primary-background-color has-white-color has-text-color has-background"
Colors (custom hex):
{"style":{"color":{"background":"#ff0000","text":"#ffffff"}}}
Produces: class="has-text-color has-background" style="color:#ffffff;background-color:#ff0000"
Typography:
{"style":{"typography":{"fontSize":"1.5rem","fontWeight":"700","lineHeight":"1.4"}}}
Typography (preset):
{"fontSize":"large"}
Produces: class="has-large-font-size"
Spacing:
{"style":{"spacing":{"padding":{"top":"2rem","right":"1rem","bottom":"2rem","left":"1rem"},"margin":{"top":"0","bottom":"2rem"}}}}
Border:
{"style":{"border":{"radius":"8px","width":"1px","color":"#e0e0e0","style":"solid"}}}
Layout:
{"layout":{"type":"constrained","contentSize":"1200px"}}
{"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}}
Alignment:
{"align":"full"}
{"align":"wide"}
{"textAlign":"center"}
Block Reference
Paragraph
No special class by default. Attributes in comment only when non-default.
<!-- wp:paragraph -->
<p>Plain text paragraph.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">First letter is large.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">Centered text.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"className":"is-style-notice"} -->
<p class="is-style-notice">Custom style variant.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"style":{"typography":{"fontSize":"1.125rem"},"color":{"text":"#555555"}}} -->
<p class="has-text-color" style="color:#555555;font-size:1.125rem">Styled paragraph.</p>
<!-- /wp:paragraph -->
Heading
level attribute controls <h1>-<h6>. Default is 2 (omit from JSON when level=2).
<!-- wp:heading -->
<h2 class="wp-block-heading">Default H2</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">H3 Heading</h3>
<!-- /wp:heading -->
<!-- wp:heading {"level":1,"style":{"typography":{"fontSize":"3rem","fontWeight":"800"}}} -->
<h1 class="wp-block-heading" style="font-size:3rem;font-weight:800">Large H1</h1>
<!-- /wp:heading -->
<!-- wp:heading {"textAlign":"center"} -->
<h2 class="wp-block-heading has-text-align-center">Centered H2</h2>
<!-- /wp:heading -->
<!-- With HTML anchor (for TOC links
Установить wp-block-markup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл wp-block-markup?
WordPress block markup syntax and HTML structure. Understand block delimiters, attributes, nesting, and how blocks serialize to the database. Based on Gutenberg source code.
Как установить скилл wp-block-markup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл wp-block-markup запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic