From 1a99f0058eaf2cdfd78ad8e2e53f42ff624dce47 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 27 May 2026 21:29:10 -0300 Subject: [PATCH] feat(playground): add MarkdownMessage component with react-markdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renders markdown safely using react-markdown ^10.1.0. Supports code blocks (pre/code fallback — no syntax highlighter), tables, lists, links, headings, blockquotes. Script tags appear as literal text (not executed) by default react-markdown behavior — no XSS possible (D15, §17.3). --- .../playground/components/MarkdownMessage.tsx | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 src/app/(dashboard)/dashboard/playground/components/MarkdownMessage.tsx diff --git a/src/app/(dashboard)/dashboard/playground/components/MarkdownMessage.tsx b/src/app/(dashboard)/dashboard/playground/components/MarkdownMessage.tsx new file mode 100644 index 0000000000..7dacd87837 --- /dev/null +++ b/src/app/(dashboard)/dashboard/playground/components/MarkdownMessage.tsx @@ -0,0 +1,157 @@ +"use client"; + +// src/app/(dashboard)/dashboard/playground/components/MarkdownMessage.tsx +import React from "react"; +import ReactMarkdown from "react-markdown"; +import remarkGfm from "remark-gfm"; +import type { Components } from "react-markdown"; + +interface MarkdownMessageProps { + content: string; + className?: string; +} + +/** + * MarkdownMessage — renders markdown safely in the Playground chat. + * + * Security notes: + * - react-markdown does NOT render raw HTML by default, so