MDX Post Example
Firefly supports posts in both MDX and Markdown. You can combine the formats in your content, but ordinary Markdown is recommended when you do not need complex features.
The Difference Between Markdown and MDX
- Markdown (MD) is a lightweight markup language for writing plain-text documents that are converted into formatted HTML. Its simple syntax makes it popular for documentation and blog posts.
- MDX extends Markdown with JSX, allowing JSX code and React components to be embedded in documents for richer interaction and dynamic content.
| Feature | Markdown | MDX |
|---|---|---|
| Basic syntax | Supported (CommonMark) | Supported (CommonMark) |
| HTML tags | Supported | Supported (as JSX) |
| Component imports | Not supported | Supported (import) |
| Dynamic data | Not supported | Supported (JS expressions) |
| Styling | Limited (class/style) | Flexible (className/CSS-in-JS) |
Built-in Firefly MDX UI Components
The following UI components are built into Firefly and can be used directly in MDX posts.
Tab Groups: TabGroup
Create switchable tabs to show code in different languages or different versions within a post.
<TabGroup labels={["test.js", "test.py"]} client:load> ```js console.log(1) ```
```py print("hello world") ```</TabGroup>console.log(1)print("hello world")Timelines: Timeline / TimelineItem
| Property | Required | Description |
|---|---|---|
date | No | A date label, such as “2024-03-10” |
title | No | Item title |
type | No | Node color: default uses the theme color; other values use the callout palette (tip / note / important / warning / caution) |
icon | No | Built-in icon displayed in the node: star / rocket / git / flag / book / heart / zap / bug / tag / calendar / code / edit |
| Body | No | Content inside <TimelineItem>; Markdown is supported |
<Timeline> <TimelineItem date="2026-08-16" title="新版本发布" icon="rocket"> 发布了全新版本,带来以下更新:
- 新增时间线组件 - 改进暗色主题
正文里支持 **Markdown** 内容。 </TimelineItem> <TimelineItem date="2025-11-02" title="站点上线" type="tip" icon="flag"> 欢迎来到我的博客。 </TimelineItem> <TimelineItem date="2025-06-15" title="项目立项" type="note"> 开始规划 Firefly 主题。 </TimelineItem></Timeline>- 2026-08-16New Version Released
A new version has been released with these updates:
- Added a timeline component
- Improved the dark theme
The body supports Markdown content.
- 2025-11-02Site Launch
Welcome to my blog.
- 2025-06-15Project Kickoff
Planning for the Firefly theme begins.
Steps: Steps / StepItem
Numbered steps are useful for tutorials and deployment instructions. Numbers are generated automatically; there is no need to supply them manually.
| Property | Required | Description |
|---|---|---|
title | No | Step title |
type | No | Number-circle color: default uses the theme color; other values use the callout palette (tip / note / important / warning / caution) |
icon | No | Built-in icon shown instead of the number (star / rocket / git / flag / book / heart / zap / bug / tag / calendar / code / edit) |
| Body | No | Content inside <StepItem>; Markdown is supported |
<Steps> <StepItem title="安装依赖"> 运行 `pnpm install`。 </StepItem> <StepItem title="启动开发服务器" type="tip" icon="rocket"> 运行 `pnpm dev`,打开 `localhost:4321`。 </StepItem> <StepItem title="编写文章"> 在 `src/content/posts/` 新建 `.mdx` 文章。 </StepItem></Steps>- Install Dependencies
Run
pnpm install. - Start the Development Server
Run
pnpm devand openlocalhost:4321. - Write a Post
Create a new
.mdxpost insrc/content/posts/.
Badges: Badge
Small colored inline badges that can be embedded in paragraphs or headings.
| Property | Required | Description |
|---|---|---|
type | No | default uses the theme color; other values use the callout palette (tip / note / important / warning / caution) |
<Badge type="tip">提示</Badge> <Badge type="warning">注意</Badge>For more information, see the MDX documentation.
Support & Share
If this article helped you, please share or support!













