File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { ComponentRegistry } from '@object-ui/core' ;
22import { Markdown } from '@/ui' ;
33
4+ /**
5+ * Markdown Renderer Component
6+ *
7+ * A schema-driven renderer that displays markdown content in Object UI applications.
8+ * This component follows the "Schema First" principle, enabling markdown rendering
9+ * through pure JSON/YAML configuration without writing custom code.
10+ *
11+ * @example
12+ * ```json
13+ * {
14+ * "type": "markdown",
15+ * "content": "# Hello World\n\nThis is **markdown** text."
16+ * }
17+ * ```
18+ *
19+ * Features:
20+ * - GitHub Flavored Markdown support (tables, strikethrough, task lists)
21+ * - XSS protection via rehype-sanitize
22+ * - Dark mode support
23+ * - Tailwind CSS prose styling
24+ */
425ComponentRegistry . register ( 'markdown' ,
526 ( { schema, className, ...props } ) => (
627 < Markdown
Original file line number Diff line number Diff line change @@ -4,8 +4,29 @@ import remarkGfm from "remark-gfm"
44import rehypeSanitize from "rehype-sanitize"
55import { cn } from "@/lib/utils"
66
7+ /**
8+ * Props for the Markdown component.
9+ *
10+ * This component renders markdown content using react-markdown with GitHub Flavored Markdown support.
11+ * All content is sanitized to prevent XSS attacks.
12+ */
713export interface MarkdownProps {
14+ /**
15+ * The markdown content to render. Supports GitHub Flavored Markdown including:
16+ * - Headers (H1-H6)
17+ * - Bold, italic, and inline code
18+ * - Links and images
19+ * - Lists (ordered, unordered, and nested)
20+ * - Tables
21+ * - Blockquotes
22+ * - Code blocks
23+ */
824 content : string
25+
26+ /**
27+ * Optional CSS class name to apply custom styling to the markdown container.
28+ * The component uses Tailwind CSS prose classes for typography by default.
29+ */
930 className ?: string
1031}
1132
You can’t perform that action at this time.
0 commit comments