feat: label code fences so Vicinae can colour them (#10)

This commit was merged in pull request #10.
This commit is contained in:
2026-10-03 21:37:11 +00:00
parent c49ffeb274
commit ac2da73669
6 changed files with 358 additions and 1 deletions
+8 -1
View File
@@ -1,3 +1,4 @@
import { labelCodeFences } from "./code";
import type { ChatTurn, ThreadMessage } from "./types";
/**
@@ -53,7 +54,13 @@ function renderMessage(message: ThreadMessage, options: TranscriptOptions): stri
// While a tool is running there is no answer text yet, so the activity line
// stands in and the user can see what Lam is actually doing.
const placeholder = message.status ? `_${message.status}…_` : "_Thinking…_";
const body = message.text.trim() || (message.isStreaming ? placeholder : "_No response._");
const body = message.text.trim()
? // Fences without a language render as a plain dark panel; labelling them
// lets Vicinae colour the code (`MdCodeBlock.qml` + KSyntaxHighlighting).
labelCodeFences(message.text.trim())
: message.isStreaming
? placeholder
: "_No response._";
const sections = [message.isStreaming ? `${body} ${STREAMING_CURSOR}` : body];
// The one thing allowed to break the plain-text rule, because it means