Modern, sleek layout for every code block
Owner: Ivan Hawkes
references: p2-us-code-to-clipboard

Polish Codeblock

The code block becomes one sleek card: bar, chip, copy button, field.

The clipboard path is sound and is kept. Verified against built output (hugo build -D of a probe page holding every fence form): the text copy-codeblock.ts writes is byte-identical to the fenced source for plain blocks, linenos=true, linenos=table, hl_lines, tab-indented, trailing-space, and file= blocks, and the line-number column is never included, because Chroma carries each line’s newline inside its .cl span. The styling around that path is what fails.

Current State

Target Design

One card, overflow: hidden and border-radius: var(--radius), full column width, hairline border, --shadow-sm, 1.5rem above and 2rem below:

Work

A finding, not a task: {hl_lines=[2,3]} in a fence’s attributes produces no .hl element in Hugo 0.166, so the band styles apply to highlighted lines only when hl_lines is set in the site or page configuration. The fence attribute changes nothing in the built markup, and the copy text of such a block is the source, as the criterion requires.

Acceptance Criteria

The checks below are run against built output and against be-best/; the clipboard text is checked by replaying the script’s extraction over the built markup of a probe page holding every fence form. The criteria that need a browsing context - real clicks, the clipboard in three browsers, the widths, the paper, and the page without scripts - were checked by hand on the served site.