Using mdx in Frosti

Using mdx in Frosti

2024 7月 12 周五
238 字 · 2 分钟

Preface

This article describes how to use the components provided by Frosti in mdx to realize the functions that can’t be realized by normal md.

Main text

Getting started

First you need to create an mdx file, which is as simple as changing the extension to .mdx.

Introducing

The components provided by Frosti are placed in the /mdx folders. Write something under the document properties (frontmatter):

import Collapse from "../../components/mdx/Collapse.astro";
import Diff from "../../components/mdx/Diff.astro";
import Error from "../../components/mdx/Error.astro";
import Info from "../../components/mdx/Info.astro";
import Kbd from "../../components/mdx/Kbd.astro";
import Success from "../../components/mdx/Success.astro";
import Warning from "../../components/mdx/Warning.astro";
import TimeLine from "../../components/mdx/TimeLine.astro";
import LinkCard from "../../components/mdx/LinkCard.astro";

Example

Collapse

This is an example text.

This is the hidden content!

<Collapse title="This is an example text.">
This is the hidden content!
</Collapse>

Diff

Right image
Left image
<Diff l="/image/l.png" r="/image/r.png" />

Error

<Error>Maybe something went wrong? </Error>

Warning

<Warning>Hey! Watch out for potholes! </Warning>

Message

<Info>It's just a message. </Info>

Success

<Success>Congratulations on your successful deployment! </Success>

Kbd

Ctrl + C to copy the text.

<Kbd>Ctrl</Kbd> + <Kbd>C</Kbd> to copy the text.

TimeLine

  • First Macintosh computer



  • iMac



  • iPod



  • iPhone



  • Apple Watch


<TimeLine
items={[
{ year: "1984", event: "First Macintosh computer" },
{ year: "1998", event: "iMac" },
{ year: "2001", event: "iPod" },
{ year: "2007", event: "iPhone" },
{ year: "2015", event: "Apple Watch" },
]}
/>

LinkCard

<LinkCard
title="Frosti"
desc="My blog project!"
url="https://github.com/GoudoMahan/Frosti"
img="/logo.png"
/>

Thanks for reading!

Using mdx in Frosti

2024 7月 12 周五
238 字 · 2 分钟
💬 评论区

💬 Giscus 评论服务未配置

请在 .env 文件中设置以下环境变量:

GISCUS_REPO=GoudoMahan/GoudoMahan.github.io
GISCUS_REPO_ID=你的仓库ID
GISCUS_CATEGORY=Announcements
GISCUS_CATEGORY_ID=你的分类ID

获取配置:giscus.app