You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SetQA.svelte maintains its own divergent local renderMarkdown (lines 618-624, used at lines 771 and 847 for completed and streaming AI answers). This duplicates the canonical pipeline in frontend/src/lib/components/markdownHelpers.ts and violates protocol #13 (DRY) in docs/protocols.md.
After v5.7.0 (ADR-149) the canonical MarkdownView pipeline gains Mermaid diagram rendering. The AI Q&A panel does not inherit that automatically because of the duplication.
Behavioural differences today
Capability
Shared MarkdownView
SetQA local
iris:// link click-through
Yes
No
Image rendering with src allowlist
Yes
No
URL-scheme allowlist
Default + iris:
Whitelist-based tag allowlist
Mermaid diagrams (post-v5.7.0)
Yes
No
Proposed change
Replace SetQA's local renderMarkdown with an import from markdownHelpers.ts and wire runMermaidIn(answerEl, currentTheme) after each {@html} injection (both completed and streaming answer containers). Verify streaming-partial mermaid degrades gracefully (incomplete fence renders as the small error placeholder until the closing fence arrives).
Acceptance criteria
AI Q&A answers render mermaid diagrams (parity with /views/[id] Text views).
AI Q&A answers honour iris:// link clicks (jump to diagram/element).
AI Q&A answers respect the canonical image-src allowlist.
No regression in existing AI Q&A rendering tests; new test asserts identical HTML between SetQA answer and MarkdownView for the same source.
Streaming answers handle in-progress mermaid fences without crashing the panel.
This issue covers the renderer fold only. Further AI-answer-specific UX (e.g. mermaid-block copy-to-clipboard, diagram fullscreen) belongs in its own follow-up.
Background
SetQA.sveltemaintains its own divergent localrenderMarkdown(lines 618-624, used at lines 771 and 847 for completed and streaming AI answers). This duplicates the canonical pipeline infrontend/src/lib/components/markdownHelpers.tsand violates protocol #13 (DRY) indocs/protocols.md.After v5.7.0 (ADR-149) the canonical
MarkdownViewpipeline gains Mermaid diagram rendering. The AI Q&A panel does not inherit that automatically because of the duplication.Behavioural differences today
MarkdownViewSetQAlocaliris://link click-throughiris:Proposed change
Replace
SetQA's localrenderMarkdownwith an import frommarkdownHelpers.tsand wirerunMermaidIn(answerEl, currentTheme)after each{@html}injection (both completed and streaming answer containers). Verify streaming-partial mermaid degrades gracefully (incomplete fence renders as the small error placeholder until the closing fence arrives).Acceptance criteria
/views/[id]Text views).iris://link clicks (jump to diagram/element).SetQAanswer andMarkdownViewfor the same source.References
docs/protocols.mdfrontend/src/lib/components/SetQA.sveltelines 618-624, 771, 847frontend/src/lib/components/markdownHelpers.tsOut of scope for this issue
This issue covers the renderer fold only. Further AI-answer-specific UX (e.g. mermaid-block copy-to-clipboard, diagram fullscreen) belongs in its own follow-up.