Fix: Task detalj renderuje markdown kao HTML kroz goldmark
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5bf7375b50
commit
23f0fba6ec
@ -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,
|
||||
}
|
||||
|
||||
|
||||
@ -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 <h1> tags
|
||||
if !containsStr(body, "<h1>") {
|
||||
t.Error("expected rendered <h1> 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)
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -25,6 +25,6 @@
|
||||
<button class="btn btn-move" hx-post="/task/{{.Task.ID}}/move?to=ready" hx-target="#board" hx-swap="outerHTML" onclick="closeDetail()">Vrati</button>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="detail-content">{{.Content}}</div>
|
||||
<div class="detail-content docs-content">{{.Content}}</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user