Zuplo
General

Markdown

A component for rendering markdown content with syntax highlighting and custom components.

Import

ReactCode
import { Markdown } from "zudoku/components";

Props

TypeScriptCode
type MarkdownProps = { content: string; className?: string; components?: Components; };

Usage

Basic Markdown

ReactCode
<Markdown content="# Hello World\n\nThis is **bold** text." />

With Custom Styling

ReactCode
<Markdown content="# Styled Content" className="max-w-2xl mx-auto" />

With Custom Components

ReactCode
const customComponents = { h1: ({ children }) => <h1 className="text-4xl font-bold text-blue-600">{children}</h1>, p: ({ children }) => <p className="text-gray-700 leading-relaxed">{children}</p>, }; <Markdown content="# Custom Heading\n\nCustom paragraph styling." components={customComponents} />;

Custom components provided via the components prop will merge with default MDX components, allowing you to override specific elements while keeping others intact.

Features

  • GitHub Flavored Markdown: Full GFM support including tables, strikethrough, and task lists
  • Syntax Highlighting: Code blocks with configurable Shiki themes
  • Raw HTML Support: Safely renders HTML mixed with markdown
  • Custom Components: Override default markdown elements with custom React components
  • Prose Styling: Built-in typography styles with dark mode support

Supported Markdown

Headers

MarkdownCode
# H1 Header ## H2 Header ### H3 Header

Emphasis

MarkdownCode
_italic_ or *italic* **bold** or __bold__ **_bold italic_** ~~strikethrough~~

Lists

MarkdownCode
- Unordered list item - Another item - Nested item 1. Ordered list item 2. Another numbered item

Code

The Markdown component supports both inline code and code blocks with syntax highlighting.

Inline code with backticks:

MarkdownCode
Inline `code` with backticks

Code blocks with syntax highlighting:

MarkdownCode
```javascript // Code block with syntax highlighting function hello() { console.log("Hello, world!"); } ```

For advanced syntax highlighting features like line numbers, titles, and line highlighting, see:

MarkdownCode
[Link text](https://example.com) ![Alt text](image.jpg)

Tables

MarkdownCode
| Column 1 | Column 2 | | -------- | -------- | | Cell 1 | Cell 2 | | Cell 3 | Cell 4 |

Configuration

The Markdown component automatically uses:

  • Remark GFM: For GitHub Flavored Markdown features
  • Rehype Raw: For HTML support
  • Shiki: For syntax highlighting with your configured themes

The Markdown component integrates with Zudoku's syntax highlighting configuration and will use the same themes as configured in your Dev Portal options.

Last modified on