diff --git a/code/internal/server/render.go b/code/internal/server/render.go index 9617bd0..7be4610 100644 --- a/code/internal/server/render.go +++ b/code/internal/server/render.go @@ -33,7 +33,7 @@ type dashboardData struct { // taskDetailData holds data for the task detail panel. type taskDetailData struct { Task supervisor.Task - Content string + Content template.HTML HasReport bool } @@ -204,10 +204,12 @@ func renderSearchResults(data searchResultsData) string { } // renderTaskDetail generates HTML fragment for task detail panel. +// Content is rendered from markdown to HTML using goldmark. func renderTaskDetail(t supervisor.Task, content string, hasReport bool) string { + rendered := renderMarkdown([]byte(content), t.ID+".md") data := taskDetailData{ Task: t, - Content: content, + Content: template.HTML(rendered), HasReport: hasReport, } diff --git a/code/internal/server/server_test.go b/code/internal/server/server_test.go index 8f305d4..4b0616f 100644 --- a/code/internal/server/server_test.go +++ b/code/internal/server/server_test.go @@ -1602,6 +1602,24 @@ func TestTaskDetail_HasInnerWrapper(t *testing.T) { } } +func TestTaskDetail_RendersMarkdownAsHTML(t *testing.T) { + srv := setupTestServer(t) + + req := httptest.NewRequest(http.MethodGet, "/task/T01", nil) + w := httptest.NewRecorder() + srv.Router.ServeHTTP(w, req) + + body := w.Body.String() + // Markdown headers should be rendered as HTML

tags + if !containsStr(body, "

") { + t.Error("expected rendered

from markdown heading") + } + // Should have docs-content class for proper styling + if !containsStr(body, "docs-content") { + t.Error("expected docs-content class on detail content") + } +} + func TestConsolePage_ToolbarAbovePanels(t *testing.T) { srv := setupTestServer(t) diff --git a/code/web/static/style.css b/code/web/static/style.css index 9eed076..b9f83b1 100644 --- a/code/web/static/style.css +++ b/code/web/static/style.css @@ -199,11 +199,7 @@ body { .btn-success:hover { background: #4ecca3; color: #1a1a2e; } .detail-content { - white-space: pre-wrap; - font-family: "JetBrains Mono", "Fira Code", monospace; - font-size: 0.8em; margin-top: 16px; - line-height: 1.6; padding: 12px; background: #111; border-radius: 6px; diff --git a/code/web/templates/partials/task-detail.html b/code/web/templates/partials/task-detail.html index fbe6be9..b0db5cd 100644 --- a/code/web/templates/partials/task-detail.html +++ b/code/web/templates/partials/task-detail.html @@ -25,6 +25,6 @@ {{end}} -
{{.Content}}
+
{{.Content}}
{{end}}