Video failed to load

MDX Post Example

505 words
3 minutes
MDX Post Example
Tip

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.
FeatureMarkdownMDX
Basic syntaxSupported (CommonMark)Supported (CommonMark)
HTML tagsSupportedSupported (as JSX)
Component importsNot supportedSupported (import)
Dynamic dataNot supportedSupported (JS expressions)
StylingLimited (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#

PropertyRequiredDescription
dateNoA date label, such as “2024-03-10”
titleNoItem title
typeNoNode color: default uses the theme color; other values use the callout palette (tip / note / important / warning / caution)
iconNoBuilt-in icon displayed in the node: star / rocket / git / flag / book / heart / zap / bug / tag / calendar / code / edit
BodyNoContent 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>
  1. 2026-08-16
    New Version Released

    A new version has been released with these updates:

    • Added a timeline component
    • Improved the dark theme

    The body supports Markdown content.

  2. 2025-11-02
    Site Launch

    Welcome to my blog.

  3. 2025-06-15
    Project 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.

PropertyRequiredDescription
titleNoStep title
typeNoNumber-circle color: default uses the theme color; other values use the callout palette (tip / note / important / warning / caution)
iconNoBuilt-in icon shown instead of the number (star / rocket / git / flag / book / heart / zap / bug / tag / calendar / code / edit)
BodyNoContent 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>
  1. Install Dependencies

    Run pnpm install.

  2. Start the Development Server

    Run pnpm dev and open localhost:4321.

  3. Write a Post

    Create a new .mdx post in src/content/posts/.


Badges: Badge#

Small colored inline badges that can be embedded in paragraphs or headings.

PropertyRequiredDescription
typeNodefault uses the theme color; other values use the callout palette (tip / note / important / warning / caution)
<Badge type="tip">提示</Badge> <Badge type="warning">注意</Badge>
New FeatureTipNoteImportantWarningCaution

For more information, see the MDX documentation.

Support & Share

If this article helped you, please share or support!

Sponsor
MDX Post Example
https://docs.bingyun.vip/en/posts/mdx-example/
Author
BingYun
Published at
1970-01-08
Profile Image of the Author
BingYun
Hello, I'm BingYun
Tags
Table of Contents