Componenteditors0.86 KB gzipZero dependencies
Markdown Preview
Standalone markdown renderer: headings, lists, code, links, bold.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add markdown-previewOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { MarkdownPreview } from "@/components/ui/markdown-preview"; <MarkdownPreview />Source code
markdown-preview.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxmarkdown-preview.tsx73 lines
"use client"; import * as React from "react";import { cn, isSafeUrl } from "./lib/utils"; export interface MarkdownPreviewProps extends React.HTMLAttributes<HTMLDivElement> { source?: string;} /** Pure markdown to JSX renderer: headings, lists, inline code, links, bold. */export function MarkdownPreview({ source = "", className, ...props }: MarkdownPreviewProps) { return ( <div className={cn("max-w-none text-sm", className)} {...props}> {render(source)} </div> );} Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { MarkdownPreview } from "@/components/ui/markdown-preview"; <MarkdownPreview />| Prop | Type | Description |
|---|---|---|
| source | string | Configures source. (Default: "") |