anomalyco / anomalyco/opencode
Copy button on v2 docs install block copies the `$` prompt prefix
@Hona is already working on this.
Since Sep 1, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
On https://opencode.ai/v2/docs, clicking Copy on the Install block also copies the leading $ on every line, so pasting into a shell fails.
What I get:
$ npm install -g @opencode-ai/cli@beta
$ bun install -g --trust @opencode-ai/cli@beta
...
The $ is not styling, it is real text. It is in the button's data-code, and the click handler writes that straight to the clipboard with no stripping:
await navigator.clipboard.writeText(t.dataset.code ?? "")
It comes from the page source. curl -H 'Accept: text/markdown' https://opencode.ai/v2/docs shows the $ hardcoded in the code prop:
<CodeBlock
code={`$ npm install -g @opencode-ai/cli@beta
$ bun install -g --trust @opencode-ai/cli@beta`}
/>
Two options:
- Strip a leading
$per line when building the clipboard string inCodeBlock. Keeps the look, fixes every block including future ones. - Drop
$from the content and render it with CSS::before. Correct by design, but touches every code block.
Option 1 seems like the smaller diff, and close to what Starlight and Mintlify do.
Repro: open the page, click Copy on the Install block, paste into a terminal. Seen on Chrome and Safari on macOS.
Happy to send a patch, but I could not find the v2 docs source in a public branch (packages/web on dev is the v1 Starlight site). Point me at the right repo or branch and I will open a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.