diff --git a/ui-tui/src/components/markdown.tsx b/ui-tui/src/components/markdown.tsx
index 3fd1b494a..e3ef7bb3b 100644
--- a/ui-tui/src/components/markdown.tsx
+++ b/ui-tui/src/components/markdown.tsx
@@ -114,6 +114,25 @@ const renderTable = (k: number, rows: string[][], t: Theme) => {
)
}
+const codeText = (text: string, color: string | undefined, key: number | string, t: Theme) => (
+
+ {text}
+
+)
+
+const plainCodeLine = (text: string, t: Theme) => {
+ const indent = text.match(/^\s+/)?.[0] ?? ''
+
+ return indent ? (
+ <>
+ {codeText(indent, undefined, 'indent', t)}
+ {text.slice(indent.length)}
+ >
+ ) : (
+ text
+ )
+}
+
function MdInline({ t, text }: { t: Theme; text: string }) {
const parts: ReactNode[] = []
@@ -316,19 +335,7 @@ function MdImpl({ compact, t, text }: MdProps) {
{block.map((l, j) => {
if (highlighted) {
- return (
-
- {highlightLine(l, lang, t).map(([color, text], kk) =>
- color ? (
-
- {text}
-
- ) : (
- {text}
- )
- )}
-
- )
+ return {highlightLine(l, lang, t).map(([color, text], kk) => codeText(text, color, kk, t))}
}
const add = isDiff && l.startsWith('+')
@@ -342,7 +349,7 @@ function MdImpl({ compact, t, text }: MdProps) {
dimColor={isDiff && !add && !del && !hunk && l.startsWith(' ')}
key={j}
>
- {l}
+ {plainCodeLine(l, t)}
)
})}