import type { Meta, StoryObj } from '@storybook/nextjs' import { useState } from 'react' import { Markdown } from '.' const SAMPLE_MD = ` # Product Update Our agent now supports **tool-runs** with structured outputs. ## Highlights - Faster reasoning with \\(O(n \\log n)\\) planning. - Inline chain-of-thought:
Thinking aloud Check cached metrics first. If missing, fetch raw warehouse data. [ENDTHINKFLAG]
## Mermaid Diagram \`\`\`mermaid graph TD Start[User Message] --> Parse{Detect Intent?} Parse -->|Tool| ToolCall[Call search tool] Parse -->|Answer| Respond[Stream response] ToolCall --> Respond \`\`\` ## Code Example \`\`\`typescript const reply = await client.chat({ message: 'Summarise weekly metrics.', tags: ['analytics'], }) \`\`\` ` const MarkdownDemo = ({ compact = false, }: { compact?: boolean }) => { const [content] = useState(SAMPLE_MD.trim()) return (
Markdown renderer
) } const meta = { title: 'Base/Data Display/Markdown', component: MarkdownDemo, parameters: { layout: 'centered', docs: { description: { component: 'Markdown wrapper with GitHub-flavored markdown, Mermaid diagrams, math, and custom blocks (details, audio, etc.).', }, }, }, argTypes: { compact: { control: 'boolean' }, }, args: { compact: false, }, tags: ['autodocs'], } satisfies Meta export default meta type Story = StoryObj export const Playground: Story = {} export const Compact: Story = { args: { compact: true, }, }