Display code snippets that respect your spacing and tabs.
Attributes
Defined via the attributes property in block.json.
| Attribute | Type | Default | Description |
|---|---|---|---|
content |
rich-text |
— | Source: rich-text. Selector: code. Role: content |
Supports
Defined via the supports property in block.json.
align:"wide"anchor:truetypography:fontSize:truelineHeight:true
spacing:margin:["top","bottom"]padding:true
color:text:truebackground:truegradients:true
interactivity:clientNavigation:true
Block Markup
This is a static block. The markup is saved directly in the post content.
<!-- wp:core/code -->
<pre class="wp-block-code"><code>export default function MyButton() {
return <Button>Click Me!</Button>;
}</code></pre>
<!-- /wp:core/code -->
Source
- block.json (reference)
- Source directory — browse
edit.js,save.js,index.php, and more.