Files
classroomio/apps/dashboard/src/lib/features/ai-assistant/utils/markdown.ts
T
2026-04-27 11:40:38 +01:00

18 lines
422 B
TypeScript

import { marked } from 'marked';
// Configure marked for safe, minimal output
marked.setOptions({
breaks: true,
gfm: true
});
/**
* Convert markdown text to sanitized HTML for rendering in the chat.
* Agent responses come as markdown — this makes them render properly.
*/
export function renderMarkdown(text: string): string {
if (!text) return '';
return marked.parse(text, { async: false }) as string;
}