feat: render chat messages as markdown with code blocks

- Add react-markdown and remark-gfm for markdown rendering
- Create MarkdownContent component with custom code block renderer
  featuring language labels and copy-to-clipboard buttons
- Add full markdown prose styles (headings, lists, tables, links,
  blockquotes, inline code) matching the dark zinc theme
- Replace plain-text message rendering in ChatPane with MarkdownContent
- Handle fenced code blocks with and without language specifiers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-21 19:04:24 +01:00
co-authored by Copilot
parent 9138aa8819
commit 879c6c145c
5 changed files with 436 additions and 4 deletions
+105
View File
@@ -102,3 +102,108 @@ textarea {
min-height: 44px;
max-height: 200px;
}
/* Markdown prose styles for chat messages */
.markdown-content {
line-height: 1.7;
word-break: break-word;
}
.markdown-content > *:first-child {
margin-top: 0;
}
.markdown-content > *:last-child {
margin-bottom: 0;
}
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
font-weight: 600;
color: #e4e4e7;
margin-top: 1.25em;
margin-bottom: 0.5em;
line-height: 1.4;
}
.markdown-content h1 { font-size: 1.25rem; }
.markdown-content h2 { font-size: 1.125rem; }
.markdown-content h3 { font-size: 1rem; }
.markdown-content p {
margin-top: 0.625em;
margin-bottom: 0.625em;
}
.markdown-content ul,
.markdown-content ol {
margin-top: 0.5em;
margin-bottom: 0.5em;
padding-left: 1.5em;
}
.markdown-content ul { list-style-type: disc; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content li {
margin-top: 0.25em;
margin-bottom: 0.25em;
}
.markdown-content li > p {
margin-top: 0.25em;
margin-bottom: 0.25em;
}
.markdown-content blockquote {
border-left: 3px solid #3f3f46;
padding-left: 1em;
color: #a1a1aa;
margin-top: 0.75em;
margin-bottom: 0.75em;
}
.markdown-content table {
width: 100%;
border-collapse: collapse;
margin-top: 0.75em;
margin-bottom: 0.75em;
font-size: 0.875rem;
}
.markdown-content th,
.markdown-content td {
border: 1px solid #27272a;
padding: 0.5em 0.75em;
text-align: left;
}
.markdown-content th {
background: #18181b;
font-weight: 600;
color: #d4d4d8;
}
.markdown-content hr {
border: none;
border-top: 1px solid #27272a;
margin: 1.5em 0;
}
.markdown-content strong {
font-weight: 600;
color: #e4e4e7;
}
.markdown-content em {
font-style: italic;
}
.markdown-content img {
max-width: 100%;
border-radius: 0.5rem;
}