fix(webui): render theme-aware markdown code blocks in dark/light mode

This commit is contained in:
yiling
2026-07-13 14:52:38 +08:00
parent d560032013
commit 15cbf12162
3 changed files with 51 additions and 1 deletions
@@ -184,7 +184,7 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp
// eslint-disable-next-line @typescript-eslint/no-unused-vars
pre: ({ node, ...props }) => (
<pre
className="whitespace-pre-wrap break-all break-words bg-gray-100 p-4 rounded-md"
className="whitespace-pre-wrap break-all break-words bg-muted text-foreground p-4 rounded-md border border-border/50 font-mono text-sm"
{...props}
/>
),
+25
View File
@@ -167,3 +167,28 @@
.no-scrollbar::-webkit-scrollbar {
display: none; /* Chrome, Safari and Opera */
}
/* Style code blocks and inline code inside .prose (rendered markdown) */
.prose pre {
background-color: var(--muted);
color: var(--foreground);
padding: 1rem;
border-radius: var(--radius-md);
border: 1px solid var(--border);
font-family: var(--font-mono);
font-size: 0.875em;
overflow-x: auto;
}
.prose code {
font-family: var(--font-mono);
}
/* Style inline code (code not inside pre) */
.prose :not(pre) > code {
background-color: var(--muted);
color: var(--foreground);
padding: 0.15rem 0.3rem;
border-radius: var(--radius-sm);
font-size: 0.875em;
}
+25
View File
@@ -123,3 +123,28 @@
@apply bg-background text-foreground;
}
}
/* Style code blocks and inline code inside .prose (rendered markdown) */
.prose pre {
background-color: var(--muted);
color: var(--foreground);
padding: 1rem;
border-radius: var(--radius-md);
border: 1px solid var(--border);
font-family: var(--font-mono);
font-size: 0.875em;
overflow-x: auto;
}
.prose code {
font-family: var(--font-mono);
}
/* Style inline code (code not inside pre) */
.prose :not(pre) > code {
background-color: var(--muted);
color: var(--foreground);
padding: 0.15rem 0.3rem;
border-radius: var(--radius-sm);
font-size: 0.875em;
}