diff --git a/apps/MTPLXApp/Sources/MTPLXAppHost/Views/Chat/Primitives/AssistantMarkdownView.swift b/apps/MTPLXApp/Sources/MTPLXAppHost/Views/Chat/Primitives/AssistantMarkdownView.swift index 5eb67b6b..36ca6c08 100644 --- a/apps/MTPLXApp/Sources/MTPLXAppHost/Views/Chat/Primitives/AssistantMarkdownView.swift +++ b/apps/MTPLXApp/Sources/MTPLXAppHost/Views/Chat/Primitives/AssistantMarkdownView.swift @@ -511,12 +511,26 @@ private struct AssistantTableView: View { } private static func inline(_ text: String) -> AttributedString { - (try? AttributedString( - markdown: text, + // Models (notably thinking-mode) emit
for in-cell line breaks in + // markdown tables. cmark hands raw HTML back as literal tag text, so + // the cell would render "
" verbatim AND keep the whole cell as one + // unbreakable token that overflows the fixed column frame into its + // neighbour (the "pile of overlapping text"). Convert
variants to + // real newlines at this single choke point so cells wrap. Comparison + // operators ("a < b") are untouched: the pattern requires "br". + // ponytail:
only — other raw tags (, ) would still show + // raw; strip-all mangles "<"/">", add a tag allowlist if they appear. + let readable = text.replacingOccurrences( + of: #""#, + with: "\n", + options: [.regularExpression, .caseInsensitive] + ) + return (try? AttributedString( + markdown: readable, options: AttributedString.MarkdownParsingOptions( interpretedSyntax: .inlineOnlyPreservingWhitespace ) - )) ?? AttributedString(text) + )) ?? AttributedString(readable) } }