Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions frontend/src/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -774,24 +774,30 @@
.markdown-body .highlight pre,
.markdown-body pre {
padding: 16px 16px 8px 16px;
overflow: auto;
overflow-x: auto;
overflow-y: hidden;
font-size: 85%;
line-height: 1.45;
border-radius: 6px;
direction: ltr;
width: 100%;
min-width: 100%;
box-sizing: border-box;
}

.markdown-body pre code,
.markdown-body pre tt {
display: inline-block;
max-width: 100%;
display: block;
padding: 0;
margin: 0;
overflow-x: scroll;
overflow-x: visible;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
white-space: pre;
width: max-content;
min-width: 100%;
}

.markdown-body .csv-data td,
Expand Down Expand Up @@ -1076,8 +1082,9 @@

.markdown-body pre code {
display: block;
overflow-x: auto;
overflow-x: visible;
padding: 1em;
box-sizing: border-box;
}

.markdown-body code {
Expand All @@ -1087,6 +1094,7 @@
.markdown-body .hljs,
.markdown-body pre {
@apply text-foreground bg-muted;
transition: none;
}

/* Theme: Tokyo-night-Dark
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export function PreCode(props: JSX.IntrinsicElements["pre"]) {
}, []);

return (
<>
<div className="w-full">
<div className="flex justify-end pt-2 mb-1">
<Button
variant="ghost"
Expand Down Expand Up @@ -252,8 +252,10 @@ export function PreCode(props: JSX.IntrinsicElements["pre"]) {
)}
</Button>
</div>
<pre ref={ref}>{props.children}</pre>
</>
<pre ref={ref} className="w-full overflow-x-auto">
{props.children}
</pre>
</div>
);
}

Expand Down Expand Up @@ -655,7 +657,8 @@ export function Markdown(
className="markdown-body"
style={{
fontSize: `${props.fontSize ?? 16}px`,
fontFamily: props.fontFamily || "inherit"
fontFamily: props.fontFamily || "inherit",
wordBreak: "break-word"
}}
ref={mdRef}
onContextMenu={props.onContextMenu}
Expand Down
Loading