← Back to task

Commit ffeb13fb

commit ffeb13fb9f2543dfc9cdecf8ed6778226267b403
Author: Ben Sima <ben@bensima.com>
Date:   Mon Dec 1 10:00:44 2025

    Render task comments as markdown in web view
    
    Use renderMarkdown for comment text instead of plain text rendering.
    Comments now support formatting, code blocks, lists, etc.
    
    Task-Id: t-204

diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index b76f1fab..6f5029d8 100644
--- a/Omni/Jr/Web.hs
+++ b/Omni/Jr/Web.hs
@@ -1624,7 +1624,7 @@ instance Lucid.ToHtml TaskDetailPage where
       renderComment :: (Monad m) => UTCTime -> TaskCore.Comment -> Lucid.HtmlT m ()
       renderComment currentTime c =
         Lucid.div_ [Lucid.class_ "comment-card"] <| do
-          Lucid.p_ [Lucid.class_ "comment-text"] (Lucid.toHtml (TaskCore.commentText c))
+          Lucid.div_ [Lucid.class_ "comment-text markdown-content"] (renderMarkdown (TaskCore.commentText c))
           Lucid.div_ [Lucid.class_ "comment-meta"] <| do
             Lucid.span_ [Lucid.class_ ("comment-author " <> authorClass)] (Lucid.toHtml (authorLabel (TaskCore.commentAuthor c)))
             Lucid.span_ [Lucid.class_ "comment-time"] (renderRelativeTimestamp currentTime (TaskCore.commentCreatedAt c))
@@ -2545,11 +2545,10 @@ renderCollapsibleOutput content =
 renderTextWithNewlines :: (Monad m) => Text -> Lucid.HtmlT m ()
 renderTextWithNewlines txt =
   let parts = Text.splitOn "\\n" txt
-   in traverse_ renderPart (zip [0 ..] parts)
-  where
-    renderPart (idx, part) = do
-      Lucid.toHtml part
-      when (idx < length parts - 1) <| Lucid.br_ []
+      renderPart idx part = do
+        Lucid.toHtml part
+        when (idx < length parts - 1) <| Lucid.br_ []
+   in traverse_ (uncurry renderPart) (zip [0 ..] parts)
 
 -- | Decode JSON tool result and render in a user-friendly way
 renderDecodedToolResult :: (Monad m) => Text -> Lucid.HtmlT m ()