GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(ui): render and improve code blocks in user messages by sandikodev · Pull Request #20942 · anomalyco/opencode

feat(ui): render and improve code blocks in user messages #20942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sandikodev wants to merge 9 commits into anomalyco:dev from sandikodev:feat/render-user-message-code

Uh oh!

There was an error while loading. Please reload this page.

Closed

feat(ui): render and improve code blocks in user messages #20942

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
f0f82bc
feat(ui): render inline code and code blocks in user messages
sandikodev Apr 3, 2026
bf61394
feat(ui): add collapse and fix spacing for user message code blocks
sandikodev Apr 3, 2026
f63f51c
feat(ui): add i18n keys for user message code block toggle
sandikodev Apr 3, 2026
f162cd2
feat(ui): add i18n translations for code block toggle in all locales
sandikodev Apr 3, 2026
72b53c6
tweak(ui): reduce excessive spacing in markdown prose
sandikodev Apr 3, 2026
975f175
fix(ui): trim orphan leading newlines after code blocks in user messages
sandikodev Apr 3, 2026
8099d2c
feat(ui): add syntax highlighting to user message code blocks
sandikodev Apr 4, 2026
3629d2f
fix(ui): fallback to plain text when fenced code blocks are unbalanced
sandikodev Apr 4, 2026
c11610b
fix(ui): auto-close unbalanced fenced code blocks instead of plain te…
sandikodev Apr 4, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
feat(ui): add i18n keys for user message code block toggle
Add ui.message.codeBlock.showMore and ui.message.codeBlock.showLess
keys to en.ts and use them in CodeBlock component instead of
hardcoded strings.
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@sandikodev
sandikodev committed Apr 3, 2026
commit f63f51c2e56dbd5296517c60d2a9b8ecdc46d2bb

There are no files selected for viewing

5 changes: 4 additions & 1 deletion 5 packages/ui/src/components/message-part.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,7 @@ function CodeBlock(props: { text: string; lang?: string }) {
const [open, setOpen] = createSignal(false)
const preview = createMemo(() => lines().slice(0, COLLAPSE_LINES).join("\n"))
const extra = createMemo(() => lines().length - COLLAPSE_LINES)
const i18n = useI18n()

return (
<div data-slot="user-message-code-block">
Expand All @@ -1150,7 +1151,9 @@ function CodeBlock(props: { text: string; lang?: string }) {
data-slot="user-message-code-toggle"
onClick={() => setOpen((v) => !v)}
>
{open() ? "Show less" : `Show ${extra()} more lines`}
{open()
? i18n.t("ui.message.codeBlock.showLess")
: i18n.t("ui.message.codeBlock.showMore", { count: String(extra()) })}
</button>
</Show>
</div>
Expand Down
3 changes: 3 additions & 0 deletions 3 packages/ui/src/i18n/en.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,7 @@ export const dict: Record<string, string> = {
"ui.question.multiHint": "Select all answers that apply",
"ui.question.singleHint": "Select one answer",
"ui.question.custom.placeholder": "Type your answer...",

"ui.message.codeBlock.showMore": "Show {{count}} more lines",
"ui.message.codeBlock.showLess": "Show less",
}
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.