Add markdown.codeBlockIndent setting to customize indentation prefix for rendered code blocks. Default remains 2 spaces for visual clarity, but setting to empty string removes indentation for easier copy/paste of code snippets to scripts, editors, or other tools. Changes: - tui: add optional codeBlockIndent to MarkdownTheme interface - coding-agent: add MarkdownSettings with codeBlockIndent property - coding-agent: compose theme with settings at call sites (no global state) - coding-agent: update message components to accept optional MarkdownTheme Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
19 lines
583 B
TypeScript
19 lines
583 B
TypeScript
import { Container, Markdown, type MarkdownTheme, Spacer } from "@mariozechner/pi-tui";
|
|
import { getMarkdownTheme, theme } from "../theme/theme.js";
|
|
|
|
/**
|
|
* Component that renders a user message
|
|
*/
|
|
export class UserMessageComponent extends Container {
|
|
constructor(text: string, markdownTheme: MarkdownTheme = getMarkdownTheme()) {
|
|
super();
|
|
this.addChild(new Spacer(1));
|
|
this.addChild(
|
|
new Markdown(text, 1, 1, markdownTheme, {
|
|
bgColor: (text: string) => theme.bg("userMessageBg", text),
|
|
color: (text: string) => theme.fg("userMessageText", text),
|
|
}),
|
|
);
|
|
}
|
|
}
|