Modern, type-safe React components for rendering markdown content via react-markdown.
Small React components used by `MemoMarkdownRenderer` to style HTML emitted by `react-markdown`.
## Architecture
## Responsibilities
### Component-Based Rendering
Following patterns from popular AI chat apps (ChatGPT, Claude, Perplexity), we use React components instead of CSS selectors for markdown rendering. This provides:
- Keep element styling local to each semantic HTML element.
- Strip the `node` prop from DOM output through `ReactMarkdownProps`.
- Preserve existing markdown behavior while avoiding structural fixes in CSS.
-**Type Safety**: Full TypeScript support with proper prop types
-**Maintainability**: Components are easier to test, modify, and understand
-**Performance**: No CSS specificity conflicts, cleaner DOM
-**Modularity**: Each element is independently styled and documented
## Task Lists
### Type System
GFM task lists are normalized before rendering by `remarkSplitMixedTaskLists`.
All components extend `ReactMarkdownProps` which includes the AST `node` prop passed by react-markdown. This is explicitly destructured as `node: _node` to:
1. Filter it from DOM props (avoids `node="[object Object]"` in HTML)
2. Keep it available for advanced use cases (e.g., detecting task lists)
3. Maintain type safety without `as any` casts
### GFM Task Lists
Task lists (from remark-gfm) are handled by:
-**Detection**: `contains-task-list` and `task-list-item` classes from remark-gfm
-**Styling**: Tailwind utilities with arbitrary variants for nested elements
-**Checkboxes**: Custom `TaskListItem` component with Radix UI checkbox
-**Interactivity**: Updates memo content via `toggleTaskAtIndex` utility
- Mixed task/bullet lists are split into separate lists so regular bullets keep bullets.
- Single-block split items are rendered as tight list items, preventing accidental `<p>` wrappers.
-`ListItem` uses a two-column grid: checkbox/control in the first column, task text and nested content in the second.
- Loose task items keep paragraph structure; the first paragraph contributes its checkbox/text to the grid, while later paragraphs align with the text column.