summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 10:00:44 -0500
committerBen Sima <ben@bensima.com>2025-12-01 10:00:44 -0500
commitffeb13fb9f2543dfc9cdecf8ed6778226267b403 (patch)
tree3f1c56d717030ebc86a81309cf2c7c555e6f2960
parentb4362d550d46d343e3b453fa569b21b4286eda10 (diff)
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
-rw-r--r--Omni/Jr/Web.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index b76f1fa..6f5029d 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 ()