SFP-BLOCKS/CODE-SNIPPET
Code snippet
A styled code snippet block with language label, optional caption, and a copy-to-clipboard button. New as of Blockset; you’re reading the result on this page already — every example markup on every per-block docs page is rendered by code-snippet.
Live
<!-- wp:paragraph -->
<p>Hello, block.</p>
<!-- /wp:paragraph -->
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
code | string | sample markup | The code body. Plain text; rendered as-is in a <code> element |
language | string | "html" | Language tag shown in the header label (display only; no syntax highlighting) |
caption | string | empty | Optional italic caption below the code |
showCopy | boolean | true | Show the copy-to-clipboard button |
Example markup
<!-- wp:sfp-blocks/code-snippet {"code":"function greet() {\n console.log(\"hello\");\n}","language":"javascript","caption":"A tiny example."} /-->