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.
|
// taskDetailData holds data for the task detail panel.
|
||||||
type taskDetailData struct {
|
type taskDetailData struct {
|
||||||
Task supervisor.Task
|
Task supervisor.Task
|
||||||
Content string
|
Content template.HTML
|
||||||
HasReport bool
|
HasReport bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,10 +204,12 @@ func renderSearchResults(data searchResultsData) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// renderTaskDetail generates HTML fragment for task detail panel.
|
// 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 {
|
func renderTaskDetail(t supervisor.Task, content string, hasReport bool) string {
|
||||||
|
rendered := renderMarkdown([]byte(content), t.ID+".md")
|
||||||
data := taskDetailData{
|
data := taskDetailData{
|
||||||
Task: t,
|
Task: t,
|
||||||
Content: content,
|
Content: template.HTML(rendered),
|
||||||
HasReport: hasReport,
|
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) {
|
func TestConsolePage_ToolbarAbovePanels(t *testing.T) {
|
||||||
srv := setupTestServer(t)
|
srv := setupTestServer(t)
|
||||||
|
|
||||||
|
|||||||
@ -199,11 +199,7 @@ body {
|
|||||||
.btn-success:hover { background: #4ecca3; color: #1a1a2e; }
|
.btn-success:hover { background: #4ecca3; color: #1a1a2e; }
|
||||||
|
|
||||||
.detail-content {
|
.detail-content {
|
||||||
white-space: pre-wrap;
|
|
||||||
font-family: "JetBrains Mono", "Fira Code", monospace;
|
|
||||||
font-size: 0.8em;
|
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
line-height: 1.6;
|
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
background: #111;
|
background: #111;
|
||||||
border-radius: 6px;
|
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>
|
<button class="btn btn-move" hx-post="/task/{{.Task.ID}}/move?to=ready" hx-target="#board" hx-swap="outerHTML" onclick="closeDetail()">Vrati</button>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-content">{{.Content}}</div>
|
<div class="detail-content docs-content">{{.Content}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user