YuhuanStudioYunUIDocs
Content

Content

The content-rendering stack — markdown, code, math, diagrams, callouts and images for LLM/chat/doc output.

The content-rendering stack turns LLM / chat / documentation output into rich, safe UI: full GitHub-flavored markdown, KaTeX math, Shiki-highlighted code, Mermaid diagrams, GitHub-style callouts, and lazy, zoomable images. It lives on its own subpath, @yuhuanowo/yunui/content, so the heavy rendering engines (shiki, mermaid) never touch apps that don't need them.

Install

The content subpath declares its rendering libraries as optional peer dependencies — install them in your app alongside YunUI:

bash
1pnpm add @yuhuanowo/yunui react-markdown remark-gfm remark-math \
2 rehype-raw rehype-katex rehype-slug katex shiki mermaid

Styles

Import the content stylesheet and the KaTeX stylesheet once, wherever you load global CSS:

css
1@import "@yuhuanowo/yunui/content.css";
2@import "katex/dist/katex.min.css";

Import

tsx
1import {
2 MarkdownRenderer,
3 CodeBlock,
4 InlineCode,
5 CalloutBlock,
6 MathRenderer,
7 InlineMath,
8 BlockMath,
9 MermaidDiagram,
10 ContentImage,
11 ImageLightbox,
12} from "@yuhuanowo/yunui/content";

Everything at once

MarkdownRenderer composes the whole stack. Feed it a markdown string with headings, a table, a task list, a fenced code block, a ```mermaid diagram, $math$, and a > [!NOTE] callout, and it renders each with the matching component.

MarkdownRenderer

Markdown renderer

Full GFM with emphasis, strikethrough, links and inline code.

Note

Callouts use GitHub's > [!TYPE] blockquote syntax — note, tip, important, warning, caution.

Table

FeatureSupportedNotes
TablesGitHub-flavored
Task listInteractive checkboxes
MathKaTeX inline & block

Task list

  • Render headings, tables and lists
  • Highlight code with Shiki
  • Ship to production

Code

TypeScript
export function greet(name: string): string {
  return `Hello, ${name}!`;
}

Math

The Gaussian integral is ex2dx=π\int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}, and in block form:
E=mc2E = mc^2

Diagram

Rendering diagram…

The pieces

Each renderer is also exported standalone so you can drop a single capability into your own layout:

On this page