CodeBlockHtmlRenderer
Paints {@see CodeBlockComponent} as a terminal: a chrome strip, prompted lines, and a copy button. ── WHY IT LOOKS LIKE A TERMINAL AND NOT LIKE A QUOTE ─────────────────────────────────────────────── «El área de code se debe parecer MÁS a una terminal […] para el humano tiene que quedar claro visualmente que hablamos de código» (Rod). A reader scanning a page decides what a block IS before reading a character of it, and a tinted rectangle of prose-width text says «quotation». The three things that say «terminal» instead are the chrome strip with a name, the prompt glyph before each line, and a monospaced line that does not wrap — all of them structure, none of them a new colour. Every value comes from the design tokens, including the darkest ground the palette has. A terminal look invented per page is how the welcome page ended up with an invisible command (greenhouse decisions/0299). ── THE COPY BUTTON IS IN THE MARKUP, NOT ADDED BY SCRIPT ─────────────────────────────────────────── It is a real `<button>` the server printed, revealed by CSS on hover and always present for the keyboard. A button a script has to inject is a button that does not exist until the script runs, and a page whose script failed then shows chrome with nothing behind it — the shape this house has measured more than once. The script only teaches the existing button what to do (greenhouse decisions/0272).
CodeBlockHtmlRenderer::supportsTarget()
public function supportsTarget(Milpa\Live\ValueObjects\RenderTarget $target): boolHTML only: a copy button and a hover affordance have nowhere to live in a TUI frame.
Parameters
| Name | Type | Description |
|---|---|---|
| $target | Milpa\Live\ValueObjects\RenderTarget |
CodeBlockHtmlRenderer::render()
public function render(Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component, Milpa\Live\ValueObjects\RenderRequest $request): Milpa\Live\ValueObjects\RenderResultThe block: chrome, one prompted line per command, and the button that takes them.
Parameters
| Name | Type | Description |
|---|---|---|
| $component | Milpa\Live\Contracts\Component\ComponentDefinitionInterface | |
| $request | Milpa\Live\ValueObjects\RenderRequest |