feat(web): render messages as markdown

Messages were plain text, so headings, lists, code, tables, and links
from people and the agent showed as literal markup. Render them with
markdown-it, with raw HTML off and unsafe link schemes blocked.
External links open in a new tab, and @rhema stays highlighted.

Code, tables, quotes, and images get styles that fit the message body.
This commit is contained in:
vhaudiquet committed 2026-11-28 22:23:41 +01:00
1 parent d4aac727ad
commit a8f7e74ba0
5 files changed
+235 -20

No files matched your search

+139 -1
View File
@@ -1158,10 +1158,148 @@ button {
.msg-text {
font-size: var(--fs-ui);
line-height: var(--lh-body);
white-space: pre-wrap;
white-space: normal;
overflow-wrap: anywhere;
}
.msg-text > :first-child {
margin-top: 0;
}
.msg-text > :last-child {
margin-bottom: 0;
}
.msg-text p,
.msg-text ul,
.msg-text ol,
.msg-text pre,
.msg-text blockquote,
.msg-text table {
margin: 0 0 var(--sp-2);
}
.msg-text h1,
.msg-text h2,
.msg-text h3,
.msg-text h4,
.msg-text h5,
.msg-text h6 {
margin: var(--sp-3) 0 var(--sp-1);
font-weight: 600;
line-height: var(--lh-heading);
}
.msg-text h1 {
font-size: var(--fs-title);
}
.msg-text h2 {
font-size: var(--fs-section);
}
.msg-text h3,
.msg-text h4,
.msg-text h5,
.msg-text h6 {
font-size: var(--fs-ui);
}
.msg-text ul,
.msg-text ol {
padding-left: var(--sp-5);
}
.msg-text li {
margin: var(--sp-1) 0;
}
.msg-text li > p {
margin: 0;
}
.msg-text blockquote {
padding-left: var(--sp-3);
border-left: 2px solid var(--border-strong);
color: var(--muted);
}
.msg-text blockquote > :last-child {
margin-bottom: 0;
}
.msg-text hr {
margin: var(--sp-3) 0;
border: 0;
border-top: 1px solid var(--border);
}
.msg-text a {
color: var(--accent);
text-decoration: underline;
text-underline-offset: 2px;
}
.msg-text a:hover {
text-decoration-thickness: 2px;
}
.msg-text code {
padding: 0 var(--sp-1);
border-radius: 4px;
background: var(--surface-2);
font-family: var(--font-mono);
font-size: var(--fs-code);
}
.msg-text pre {
padding: var(--sp-2) var(--sp-3);
border: 1px solid var(--border);
border-radius: var(--r-control);
background: var(--surface-2);
overflow-x: auto;
overflow-wrap: normal;
scrollbar-width: thin;
}
.msg-text pre code {
padding: 0;
border-radius: 0;
background: transparent;
font-size: var(--fs-code);
line-height: var(--lh-body);
white-space: pre;
}
.msg-text img {
display: block;
max-width: 100%;
height: auto;
margin: var(--sp-2) 0;
border-radius: var(--r-control);
}
.msg-text table {
display: block;
max-width: 100%;
overflow-x: auto;
border-collapse: collapse;
font-size: var(--fs-meta);
}
.msg-text th,
.msg-text td {
padding: var(--sp-1) var(--sp-2);
border: 1px solid var(--border);
text-align: left;
vertical-align: top;
}
.msg-text th {
background: var(--surface-2);
font-weight: 600;
}
.mention {
color: var(--accent);
font-weight: 600;