<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh_CN">
  <title>XiaoMai</title>
  <subtitle>博客</subtitle>
  <link href="https://xiaomai.l.cd/" rel="alternate" type="text/html"/>
  <link href="https://xiaomai.l.cd/atom.xml" rel="self" type="application/atom+xml"/>
  <id>https://xiaomai.l.cd/</id>
  <updated>2026-09-15T00:00:00.000Z</updated>
  <entry>
    <title>XiaoMai 写作与使用指南</title>
    <link href="https://xiaomai.l.cd/posts/guide/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/guide/</id>
    <published>2026-08-26T00:00:00.000Z</published>
    <updated>2026-08-26T00:00:00.000Z</updated>
    <summary>XiaoMai 文章写作、frontmatter 规范、Markdown 扩展、加密与媒体资源的完整指南。</summary>
    <content type="html"><![CDATA[<p>欢迎使用 <strong>XiaoMai</strong>（小麦）——一款富有表现力、受动漫风格启发的博客主题，围绕 <strong>Astro 7</strong>、<strong>Svelte 5</strong> 与 <strong>Material 3 Expressive（M3E）</strong> 设计系统打造。</p>
<p>本指南将带你了解文章创建、frontmatter 规范、目录结构，以及全套内置的 Markdown 与 MDX 扩展。</p>
<p>:::tip
XiaoMai 优先在服务器端渲染内容（SSR-first）。在站内导航时，Swup 会无缝替换主容器，同时保留外层应用外壳与持续的背景音乐播放。
:::</p>
<hr />
<h2>1. 创建新文章</h2>
<p>你可以使用内置 CLI 命令快速生成带有标准 frontmatter 的新文章：</p>
<pre><code># 创建单文件文章
pnpm new-post my-first-post

# 或在子目录中创建文章
pnpm new-post guides/getting-started
</code></pre>
<p>新创建的文件会放置在 <code>src/content/posts/</code> 目录下。</p>
<hr />
<h2>2. Frontmatter 规范</h2>
<p>每篇 Markdown（<code>.md</code>）或 MDX（<code>.mdx</code>）文章都以一段 YAML frontmatter 开头，用于定义其元数据。</p>
<h3>示例</h3>
<pre><code>---
title: "Exploring Material 3 Expressive Design"
published: 2026-08-26
updated: 2026-08-27
publishedAt: 2026-08-26T10:00:00+08:00
updatedAt: 2026-08-27T09:30:00+08:00
pinned: true
description: "A deep dive into dynamic HCT color science and fluid transitions in XiaoMai."
image: "./cover.webp"
tags: [M3E, Design, Frontend]
category: Guides
draft: false
comment: true
---
</code></pre>
<h3>支持的 Frontmatter 字段</h3>
<table>
<thead>
<tr>
<th>字段</th>
<th>类型</th>
<th>必填</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>title</code></td>
<td><code>string</code></td>
<td><strong>是</strong></td>
<td>文章的主标题。</td>
</tr>
<tr>
<td><code>published</code></td>
<td><code>Date</code></td>
<td><strong>是</strong></td>
<td>发布日期，格式为 <code>YYYY-MM-DD</code>。</td>
</tr>
<tr>
<td><code>publishedAt</code></td>
<td><code>Date</code></td>
<td>否</td>
<td>精确发布时刻，用于排序同一天发布的文章。它必须落在 <code>published</code> 所配置的站点时区内。</td>
</tr>
<tr>
<td><code>updated</code></td>
<td><code>Date</code></td>
<td>否</td>
<td>最后更新日期。提供后会显示更新提示徽标。</td>
</tr>
<tr>
<td><code>updatedAt</code></td>
<td><code>Date</code></td>
<td>否</td>
<td>供订阅源与机器可读元数据使用的精确更新时刻。必须与 <code>updated</code> 配对。</td>
</tr>
<tr>
<td><code>pinned</code></td>
<td><code>boolean</code></td>
<td>否</td>
<td>将文章置顶到文章列表顶部（默认：<code>false</code>）。</td>
</tr>
<tr>
<td><code>description</code></td>
<td><code>string</code></td>
<td>否</td>
<td>文章摘要，显示在文章卡片、搜索结果与 OpenGraph 元数据中。</td>
</tr>
<tr>
<td><code>image</code></td>
<td><code>string</code></td>
<td>否</td>
<td>封面图路径。支持相对路径（<code>./cover.webp</code>）、公共路径（<code>/images/cover.jpg</code>）或远程 URL。</td>
</tr>
<tr>
<td><code>tags</code></td>
<td><code>string[]</code></td>
<td>否</td>
<td>用于分类筛选与标签云的标签名数组。</td>
</tr>
<tr>
<td><code>category</code></td>
<td><code>string</code></td>
<td>否</td>
<td>用于分类索引的主分类名称。</td>
</tr>
<tr>
<td><code>draft</code></td>
<td><code>boolean</code></td>
<td>否</td>
<td>标记为draft。draft文章在生产构建（<code>pnpm build</code>）期间会被隐藏。</td>
</tr>
<tr>
<td><code>comment</code></td>
<td><code>boolean</code></td>
<td>否</td>
<td>为该篇特定文章开关评论区（默认：<code>true</code>）。</td>
</tr>
<tr>
<td><code>lang</code></td>
<td><code>string</code></td>
<td>否</td>
<td>语言代码（例如 <code>en</code>、<code>zh_CN</code>、<code>ja</code>），当与站点默认值不同时使用。</td>
</tr>
</tbody>
</table>
<hr />
<h2>3. 文章加密</h2>
<p>XiaoMai 提供客户端文章加密。对于私人日记或受限文章，可在 frontmatter 中指定密码：</p>
<pre><code>---
title: "Private Research Notes"
published: 2026-08-26
encrypted: true
password: "your-secret-passphrase"
passwordHint: "Favorite anime character"
hideHomeContent: true
---
</code></pre>
<ul>
<li><code>encrypted</code>：设为 <code>true</code> 以启用加密；</li>
<li><code>password</code>：解锁文章所需的口令字符串或数字；</li>
<li><code>passwordHint</code>：可选提示，显示在密码输入表单上方；</li>
<li><code>hideHomeContent</code>：在首页隐藏字数统计与内容预览，防止数据泄露。</li>
</ul>
<hr />
<h2>4. 组织文章文件</h2>
<p>XiaoMai 同时支持基于文件夹的就近存放与单文件布局：</p>
<h3>文件夹结构（本地资源推荐）</h3>
<p>将文章与其媒体资源就近存放，可让资源管理变得简单：</p>
<pre><code>src/content/posts/
├── my-great-post/
│   ├── index.md           &lt;-- 文章内容
│   ├── cover.webp         &lt;-- 封面图（image: "./cover.webp"）
│   └── diagram.png        &lt;-- Markdown 中引用的内联插图
</code></pre>
<h3>单文件结构（轻量随笔）</h3>
<pre><code>src/content/posts/
├── hello-world.md
└── quick-thoughts.md
</code></pre>
<hr />
<h2>5. 丰富的 Markdown 与 MDX 扩展</h2>
<p>XiaoMai 开箱即用地内置了现代化的 Markdown 扩展：</p>
<h3>5.1 admonitions（Admonitions）</h3>
<p>使用容器指令来呈现备注、提示、警告与警示：</p>
<pre><code>:::tip
使用admonitions容器来突出关键要点或最佳实践。
:::

:::warning
使用警告容器来提示潜在的陷阱或破坏性变更。
:::
:::note
使用备注容器来记录补充性的背景信息或补充说明。
:::
:::info
使用信息容器来提供中性的上下文说明，帮助理解周围内容。
:::
:::important
使用重要容器来强调必须留意的关键事项或约束条件。
:::
:::caution
使用警示容器来标注高风险、不可逆或需要格外小心的操作。
:::
:::details
使用详情容器来收纳可折叠的可选内容，默认收起。
:::
</code></pre>
<p>:::tip
使用admonitions容器来突出关键要点或最佳实践。
:::</p>
<p>:::warning
使用警告容器来提示潜在的陷阱或破坏性变更。
:::</p>
<p>:::note
使用备注容器来记录补充性的背景信息或补充说明。
:::
:::info
使用信息容器来提供中性的上下文说明，帮助理解周围内容。
:::
:::important
使用重要容器来强调必须留意的关键事项或约束条件。
:::
:::caution
使用警示容器来标注高风险、不可逆或需要格外小心的操作。
:::
:::details
使用详情容器来收纳可折叠的可选内容，默认收起。
:::</p>
<h3>5.2 GitHub 仓库卡片</h3>
<p>使用指令语法嵌入实时、样式精美的 GitHub 仓库卡片：</p>
<pre><code>::github{repo="GrowWheat/XiaoMai"}
</code></pre>
<p>::github{repo="GrowWheat/XiaoMai"}</p>
<h3>5.3 Expressive Code 代码块</h3>
<p>增强型代码块具备语法高亮、文件名徽标、行号以及选择性行高亮等特性：</p>
<pre><code>// Dynamic HCT color token derivation
import { argbFromHex, themeFromSourceColor } from "@material/material-color-utilities";

const theme = themeFromSourceColor(argbFromHex("#f472b6"));
console.log("Primary color token:", theme.schemes.light.primary);
</code></pre>
<h3>5.4 数学排版（KaTeX）</h3>
<p>直接在 Markdown 中渲染优雅的 LaTeX 数学公式：</p>
<ul>
<li><strong>行内公式</strong>： $E = mc^2$ 或欧拉公式 $e^{i\pi} + 1 = 0$。</li>
<li><strong>块级公式</strong>：</li>
</ul>
<p>$$
\int_{-\infty}^{\infty} e^{-x^2} , dx = \sqrt{\pi}
$$</p>
<h3>5.5 Mermaid 图表</h3>
<p>使用纯文本创建流程图、时序图与架构图：</p>
<pre><code>sequenceDiagram
    autonumber
    actor Visitor as 访客
    participant Page as XiaoMai 页面
    participant Swup as Swup 容器
    participant Audio as 常驻外壳

    Visitor-&gt;&gt;Page: 点击导航链接
    Page-&gt;&gt;Swup: 触发无缝过渡
    Swup-&gt;&gt;Page: 替换 #swup-container
    Note over Audio: 背景音乐持续播放
    Page--&gt;&gt;Visitor: 新页面已渲染
</code></pre>
<h3>5.6 图片画廊与 Fancybox 灯箱</h3>
<p>图片会自动与 Fancybox 集成，支持无损缩放、平移手势与全屏预览：</p>
<pre><code>![Cover preview](./cover.jpeg)
</code></pre>
<p><img src="./cover.jpeg" alt="Cover preview" /></p>
<hr />
<h2>6. 后续步骤与自定义</h2>
<ul>
<li><strong>站点配置</strong>：了解 <code>src/config/siteConfig.ts</code> 与 <a href="/about/"><code>src/config/README.md</code></a> 中的全局设置。</li>
<li><strong>设计令牌</strong>：在 <code>DESIGN.md</code> 与 <code>docs/m3e-standard.md</code> 中探索令牌与调色板。</li>
<li><strong>反馈与社区</strong>：在 <a href="https://github.com/GrowWheat/XiaoMai/issues">GitHub Issues</a> 上分享你的想法与问题。</li>
</ul>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>🔒 密码保护与文章加密演示</title>
    <link href="https://xiaomai.l.cd/posts/%E5%8A%A0%E5%AF%86%E7%A4%BA%E4%BE%8B/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E5%8A%A0%E5%AF%86%E7%A4%BA%E4%BE%8B/</id>
    <published>2026-08-20T00:00:00.000Z</published>
    <updated>2026-08-20T00:00:00.000Z</updated>
    <summary>该文章内容已加密，请输入密码后查看。</summary>
    <content type="html"><![CDATA[<p><em>🔒 本文已加密保护，请访问博客网站输入密码阅读全文。</em></p>]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>XiaoMai Markdown 增强功能</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E5%A2%9E%E5%BC%BA%E5%8A%9F%E8%83%BD/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E5%A2%9E%E5%BC%BA%E5%8A%9F%E8%83%BD/</id>
    <published>2026-08-19T00:00:00.000Z</published>
    <updated>2026-08-19T00:00:00.000Z</updated>
    <summary>探索 XiaoMai 的自定义 Markdown 扩展、表现力组件与写作语法。</summary>
    <content type="html"><![CDATA[<p>XiaoMai 提供了一系列主题专属的 Markdown 扩展与自定义语法容器。基于我们原生的 unified AST 处理管线构建，所有扩展在站点构建时即渲染为无障碍、语义化的 HTML，具备<strong>零客户端 JavaScript 水合开销</strong>与 <strong>100% M3E 设计令牌对齐</strong>。</p>
<h2>文件树</h2>
<p>文件树可将多层项目结构、源码层级与终端目录输出，转换为紧凑、可交互的树状视图，带有自动扩展名图标、差异高亮与可折叠分支。</p>
<h3>1. 嵌套列表语法（<code>:::file-tree</code>）</h3>
<p>当直接以 Markdown 嵌套列表的形式书写文件层级时，使用 <code>:::file-tree</code> 块指令。</p>
<pre><code>:::file-tree{title="XiaoMai source tree"}
- src
  - components/
    - ++ Navigation.svelte # added component
    - -- Button.astro # removed component
  - content
    - posts/
      - markdown-增强功能.md
  - layouts/
    - PostLayout.astro
  - plugins
    - markdown/
      - rehype-file-tree.mjs
  - styles
    - markdown/
      - trees.css
  - **content.config.ts** # important file
- public/
  - favicon.svg
- package.json
:::
</code></pre>
<p>:::file-tree{title="XiaoMai 源码树"}</p>
<ul>
<li>src
<ul>
<li>components/
<ul>
<li>++ Navigation.svelte # added component</li>
<li>-- Button.astro # removed component</li>
</ul>
</li>
<li>content
<ul>
<li>posts/
<ul>
<li>markdown-增强功能.md</li>
</ul>
</li>
</ul>
</li>
<li>layouts/
<ul>
<li>PostLayout.astro</li>
</ul>
</li>
<li>plugins
<ul>
<li>markdown/
<ul>
<li>rehype-file-tree.mjs</li>
</ul>
</li>
</ul>
</li>
<li>styles
<ul>
<li>markdown/
<ul>
<li>trees.css</li>
</ul>
</li>
</ul>
</li>
<li><strong>content.config.ts</strong> # important file</li>
</ul>
</li>
<li>public/
<ul>
<li>favicon.svg</li>
</ul>
</li>
<li>package.json
:::</li>
</ul>
<h4>写作规则与标记</h4>
<ul>
<li><strong>差异状态</strong>：在条目前加 <code>++</code>（绿色背景与徽标）或 <code>--</code>（红色背景与删除线）以突出改动。</li>
<li><strong>注释</strong>：<code>#</code> 之后的任意文本会渲染为弱化的、右对齐行内注释。</li>
<li><strong>强调</strong>：用 <code>**粗体**</code> 包裹名称，让关键文件获得醒目的视觉权重。</li>
<li><strong>可折叠文件夹</strong>：由嵌套列表项推断出的目录默认展开。添加末尾斜杠（例如 <code>components/</code>）可创建一个折叠目录，读者可通过点击或键盘导航展开。</li>
</ul>
<hr />
<h3>2. 终端输出语法（<code>```file-tree</code>）</h3>
<p>当你已经有用 <code>tree</code> 等命令行工具生成的目录树文本时，可直接粘贴进 <code>file-tree</code> 围栏代码块。Unicode 分支字符（<code>├──</code>、<code>└──</code>、<code>│</code>）与 ASCII 分支都会被自动解析。</p>
<pre><code>```file-tree title="Build output" icon="simple"
dist
├── _astro/
│   ├── index.css
│   └── page.js
└── favicon.ico
```
</code></pre>
<pre><code>dist
├── _astro/
│   ├── index.css
│   └── page.js
└── favicon.ico
</code></pre>
<h4>配置选项</h4>
<ul>
<li><code>title="string"</code>：为树设置自定义标题与无障碍标签。</li>
<li><code>icon="colored" | "simple"</code>：在多彩扩展图标（<code>colored</code>，默认）与极简单色图标（<code>simple</code>）之间选择。</li>
</ul>
<hr />
<h2>代码树</h2>
<p>交互式代码树将左侧的多级文件层级导航面板与右侧的即时代码面板切换配对。它们为多文件示例、模块或整个目录的导读提供了类似 IDE 的阅读体验。</p>
<h3>1. 容器语法（<code>:::code-tree</code>）</h3>
<p>在 <code>:::code-tree</code> 块指令中组合多个围栏代码块。每个代码块通过 <code>title="path/to/file"</code> 指定其路径。</p>
<pre><code>:::code-tree{title="XiaoMai Component Demo" height="380px" entry="src/Button.svelte"}
```svelte title="src/Button.svelte"
&lt;script lang="ts"&gt;
  let { label = "Click me" } = $props();
&lt;/script&gt;

&lt;button class="m3-btn"&gt;{label}&lt;/button&gt;
```

```stylus title="src/styles/button.styl"
.m3-btn
  background: var(--primary)
  color: var(--on-primary)
  border-radius: var(--shape-corner-m)
```

```json title="package.json"
{
  "name": "button-demo",
  "version": "1.0.0"
}
```
:::
</code></pre>
<p>:::code-tree{title="XiaoMai 组件演示" height="380px" entry="src/Button.svelte"}</p>
<pre><code>&lt;script lang="ts"&gt;
  let { label = "Click me" } = $props();
&lt;/script&gt;

&lt;button class="m3-btn"&gt;{label}&lt;/button&gt;
</code></pre>
<pre><code>.m3-btn
  background: var(--primary)
  color: var(--on-primary)
  border-radius: var(--shape-corner-m)
</code></pre>
<pre><code>{
  "name": "button-demo",
  "version": "1.0.0"
}
</code></pre>
<p>:::</p>
<h4>配置与标记</h4>
<ul>
<li><code>title="string"</code>：为代码树设置标题与无障碍标签。</li>
<li><code>height="string"</code>：设置桌面视图的高度（默认 <code>420px</code>，例如 <code>380px</code>、<code>26rem</code>）。</li>
<li><code>entry="filepath"</code>：指定首次加载时处于激活状态的文件。</li>
<li><code>icon="colored" | "simple"</code>：在彩色或极简单色文件图标之间切换。</li>
<li><code>:active</code>：在任意围栏代码块上放置 <code>:active</code>，将其指定为默认激活标签页。</li>
</ul>
<hr />
<h3>2. 本地目录自动导入（<code>@[code-tree]</code>）</h3>
<p>直接指向工作区中的任意本地目录路径，即可在构建时自动扫描并生成交互式代码树，无需手动复制文件内容。</p>
<pre><code>@[code-tree title="代码树工具" entry="code-tree.ts"](/src/utils)
</code></pre>
<p>@<a href="/src/config">code-tree title="站点配置" entry="siteConfig.ts"</a></p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>图片画廊网格：语法与完整示例</title>
    <link href="https://xiaomai.l.cd/posts/image-grid-demo/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/image-grid-demo/</id>
    <published>2026-09-15T00:00:00.000Z</published>
    <updated>2026-09-15T00:00:00.000Z</updated>
    <summary>图片画廊网格的语法、参数、裁剪、响应式行为、图注与灯箱导航完整指南。</summary>
    <content type="html"><![CDATA[<p><code>:::grid</code> 是博客的图片画廊容器指令。它把普通 Markdown 图片排列成统一宽高比、响应式的网格，并自动启用灯箱查看。可用于文章配图、截图、作品集或小型相册。</p>
<p>同一画廊中的图片采用相同的卡片比例。默认情况下，居中对齐裁剪会填满每张卡片，并保持每一行整齐；点击图片会在灯箱中打开完整的原图。每个画廊拥有独立的灯箱分组，不会与文章中的其他图片混在一起。</p>
<blockquote>
<p>本文既是功能文档，也是视觉测试页。请在桌面、平板和手机宽度下查看示例，然后点击任意图片以验证灯箱分组是否正确。</p>
</blockquote>
<h2>最简语法</h2>
<p>直接在 <code>:::grid</code> 与结束标记 <code>:::</code> 之间书写 Markdown 图片：</p>
<pre><code>:::grid
![Image description](./image-1.webp)

![Image description](./image-2.webp)
:::
</code></pre>
<p>每张图片必须独占一个段落，图片之间需保留空行。画廊中只放图片；段落、列表和代码块请写在容器之外。</p>
<p>以下是最简语法的效果。不带参数时，网格默认使用三列、<code>16/10</code> 比例和 <code>cover</code> 填充模式。</p>
<p>:::grid
<img src="./landscape-1.webp" alt="最简语法效果：第一张图片" /></p>
<p><img src="./landscape-2.webp" alt="最简语法效果：第二张图片" />
:::</p>
<h2>参数一览</h2>
<p>将所有参数以花括号写在起始指令之后：<code>:::grid{parameter="value"}</code>。</p>
<table>
<thead>
<tr>
<th>参数</th>
<th>允许值</th>
<th>默认值</th>
<th>用途</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>columns</code></td>
<td><code>1</code> 到 <code>6</code> 之间的整数</td>
<td><code>3</code></td>
<td>桌面端每行显示的列数。非法值回退到 <code>3</code>。</td>
</tr>
<tr>
<td><code>aspect</code></td>
<td>正比例，例如 <code>16/9</code>、<code>3/4</code> 或 <code>1/1</code></td>
<td><code>16/10</code></td>
<td>显示的卡片比例，而非原始图片比例。</td>
</tr>
<tr>
<td><code>fit</code></td>
<td><code>cover</code>、<code>contain</code></td>
<td><code>cover</code></td>
<td>图片适配模式。<code>cover</code> 裁剪填充；<code>contain</code> 保留完整图片，可能留下空白。</td>
</tr>
</tbody>
</table>
<p>完整示例：</p>
<pre><code>:::grid{columns="3" aspect="16/9" fit="cover"}
![First image](./image-1.webp "Optional caption")

![Second image](./image-2.webp "Optional caption")

![Third image](./image-3.webp "Optional caption")
:::
</code></pre>
<p>以下结果使用了上面的三列横向语法。请对比卡片比例、列数，以及标题优先于 alt 文本作为图注的方式：</p>
<p>:::grid{columns="3" aspect="16/9" fit="cover"}
<img src="./landscape-1.webp" alt="参数示例：第一张横向图片" title="横向图注 1" /></p>
<p><img src="./landscape-2.webp" alt="参数示例：第二张横向图片" title="横向图注 2" /></p>
<p><img src="./landscape-3.webp" alt="参数示例：第三张横向图片" title="横向图注 3" />
:::</p>
<h2>图注与 Alt 文本</h2>
<p>图片的 alt 文本既作为无障碍替代文本，也作为默认图注。当图片带有可选的标题（title）时，将以该标题作为图注：</p>
<pre><code>![Text used for accessibility](./image.webp "Caption shown below the image")
</code></pre>
<p>在同一行中，图注会统一对齐到每张卡片的底部。折行的图注不会使其他卡片浮动到不同高度。诸如 <code>3:4</code> 和 <code>16:9</code> 这样的比例文字可直接写在正文、标题和 alt 文本中，无需转义。</p>
<p>以下示例演示了默认 alt 文本图注、显式标题图注，以及较长图注的底部对齐：</p>
<p>:::grid{columns="3" aspect="1/1"}
<img src="./square-1.webp" alt="这张图片没有标题，因此以 alt 文本作为图注" /></p>
<p><img src="./square-2.webp" alt="带无障碍 alt 文本的第二张方形图片" title="此标题作为图注显示" /></p>
<p><img src="./square-3.webp" alt="一张 3:4 海报的无障碍描述" title="这是一段较长的图注，用于验证图注折行时仍对齐到各自卡片的底部" />
:::</p>
<h2>布局与裁剪</h2>
<p>桌面布局采用 <code>columns</code> 指定的列数。低于 <code>768px</code> 时，网格最多两列；低于 <code>480px</code> 时，切换为一列。卡片外层固定 <code>aspect</code> 比例并裁剪圆角，图片则填满卡片，不受主题默认图片边距影响。</p>
<ul>
<li>选择 <code>cover</code>：推荐的默认模式。图片从中心裁剪以填满卡片，使画廊看起来整齐一致。</li>
<li>选择 <code>contain</code>：显示完整原图，不做裁剪。当其比例与卡片不同时，主题背景会保持可见；适用于不能裁剪的图片。</li>
<li>若要保留完整图片且不出现空白，请将 <code>aspect</code> 设置为接近原图比例，或将图片单独放入一个网格。</li>
</ul>
<p>以下示例将相同的纵向图片分别放入 <code>16/9</code> 卡片，使用 <code>cover</code> 与 <code>contain</code>。前者裁剪图片；后者保留完整图片并留出背景空间。</p>
<pre><code>:::grid{columns="3" aspect="16/9" fit="cover"}
![Image description](./image-1.webp "Optional caption")

![Image description](./image-2.webp "Optional caption")
:::

:::grid{columns="3" aspect="16/9" fit="contain"}
![Image description](./image-1.webp "Optional caption")

![Image description](./image-2.webp "Optional caption")
:::
</code></pre>
<p>:::grid{columns="3" aspect="16/9" fit="cover"}
<img src="./default-portrait-1.webp" alt="第一张 cover 效果" title="Cover：中心裁剪" /></p>
<p><img src="./default-portrait-2.webp" alt="第二张 cover 效果" title="Cover：填满卡片" /></p>
<p><img src="./default-portrait-3.webp" alt="第三张 cover 效果" title="Cover：更一致的布局" />
:::</p>
<p>:::grid{columns="3" aspect="16/9" fit="contain"}
<img src="./default-portrait-1.webp" alt="第一张 contain 效果" title="Contain：保留完整原图" /></p>
<p><img src="./default-portrait-2.webp" alt="第二张 contain 效果" title="Contain：可能出现空白" /></p>
<p><img src="./default-portrait-3.webp" alt="第三张 contain 效果" title="Contain：适用于边缘细节" />
:::</p>
<h2>默认配置</h2>
<p>不带属性时，默认是三列、<code>16/10</code> 比例和 <code>cover</code> 裁剪。这三张纵向图片用于验证默认裁剪与图注。</p>
<pre><code>:::grid
![Image description](./image-1.webp)

![Image description](./image-2.webp)

![Image description](./image-3.webp)
:::
</code></pre>
<p>:::grid
<img src="./default-portrait-1.webp" alt="默认配置：纵向图片一" /></p>
<p><img src="./default-portrait-2.webp" alt="默认配置：纵向图片二" /></p>
<p><img src="./default-portrait-3.webp" alt="默认配置：纵向图片三" />
:::</p>
<h2>三列纵向图片：3:4</h2>
<p>使用 <code>aspect="3/4"</code> 时，三张纵向图片会填满比例一致的竖卡片。若原图比例不同，<code>cover</code> 会从中心裁掉边缘。</p>
<pre><code>:::grid{columns="3" aspect="3/4"}
![Portrait image description](./portrait-1.webp)

![Portrait image description](./portrait-2.webp)

![Portrait image description](./portrait-3.webp)
:::
</code></pre>
<p>:::grid{columns="3" aspect="3/4"}
<img src="./default-portrait-1.webp" alt="3:4 测试图片一" title="纵向 1" /></p>
<p><img src="./default-portrait-2.webp" alt="3:4 测试图片二" title="纵向 2" /></p>
<p><img src="./default-portrait-3.webp" alt="3:4 测试图片三" title="纵向 3" />
:::</p>
<h2>三列横向图片：16:9</h2>
<p>这组示例演示了三列布局中常见的视频封面比例。当横向图片接近卡片比例时，裁剪量最小。</p>
<pre><code>:::grid{columns="3" aspect="16/9"}
![Landscape image description](./landscape-1.webp)

![Landscape image description](./landscape-2.webp)

![Landscape image description](./landscape-3.webp)
:::
</code></pre>
<p>:::grid{columns="3" aspect="16/9"}
<img src="./feature-landscape-1.webp" alt="16:9 测试图片一" /></p>
<p><img src="./feature-landscape-2.webp" alt="16:9 测试图片二" /></p>
<p><img src="./feature-landscape-3.webp" alt="16:9 测试图片三" />
:::</p>
<h2>两列方形图片：1:1</h2>
<p>需要较大预览卡片时，两列效果很好。第三张图片会移到下一行。最后一行保持网格轨道宽度，而不会拉伸图片填满整行。</p>
<pre><code>:::grid{columns="2" aspect="1/1"}
![Square image description](./square-1.webp)

![Square image description](./square-2.webp)

![Square image description](./square-3.webp)
:::
</code></pre>
<p>:::grid{columns="2" aspect="1/1"}
<img src="./mixed-square-1.webp" alt="1:1 测试图片一" /></p>
<p><img src="./mixed-square-2.webp" alt="1:1 测试图片二" /></p>
<p><img src="./mixed-square-3.webp" alt="1:1 测试图片三" />
:::</p>
<h2>四列与 <code>contain</code></h2>
<p><code>fit="contain"</code> 不会对原图做裁剪。当图片比例与卡片比例不同，主题背景会保持可见。这是有意为之，而非布局问题。它同时验证了四列网格与独立灯箱分组不会互相干扰。</p>
<pre><code>:::grid{columns="4" aspect="16/9" fit="contain"}
![Image description](./image-1.webp)

![Image description](./image-2.webp)

![Image description](./image-3.webp)
:::
</code></pre>
<p>:::grid{columns="4" aspect="16/9" fit="contain"}
<img src="./default-portrait-1.webp" alt="Contain：纵向图片一" /></p>
<p><img src="./default-portrait-2.webp" alt="Contain：纵向图片二" /></p>
<p><img src="./default-portrait-3.webp" alt="Contain：纵向图片三" />
:::</p>
<h2>单列细节图片</h2>
<p>当图片需要较大阅读尺寸时，单列正合适。它在桌面、平板和手机上都保持单列，灯箱中仍可查看原图。</p>
<pre><code>:::grid{columns="1" aspect="16/9"}
![Image description](./detail.webp)
:::
</code></pre>
<p>:::grid{columns="1" aspect="16/9"}
<img src="./feature-landscape-1.webp" alt="单列测试图片" />
:::</p>
<h2>稀疏五列行</h2>
<p>五列用于验证更高的支持列数。由于只有三张图片，最后一行保持左对齐，而不会拉伸图片。</p>
<pre><code>:::grid{columns="5" aspect="1/1"}
![Thumbnail description](./thumb-1.webp)

![Thumbnail description](./thumb-2.webp)

![Thumbnail description](./thumb-3.webp)
:::
</code></pre>
<p>:::grid{columns="5" aspect="1/1"}
<img src="./mixed-square-1.webp" alt="五列测试图片一" /></p>
<p><img src="./mixed-square-2.webp" alt="五列测试图片二" /></p>
<p><img src="./mixed-square-3.webp" alt="五列测试图片三" />
:::</p>
<h2>六列中的混合图片</h2>
<p>六列是当前的最大值。混合横向与纵向图片，用于验证 <code>cover</code> 裁剪、窄卡片上的图注，以及密集的桌面布局。就文章正文可读性而言，通常两到四列更合适。</p>
<pre><code>:::grid{columns="6" aspect="1/1"}
![Image description](./image-1.webp)

![Image description](./image-2.webp)

![Image description](./image-3.webp)

![Image description](./image-4.webp)

![Image description](./image-5.webp)

![Image description](./image-6.webp)
:::
</code></pre>
<p>:::grid{columns="6" aspect="1/1"}
<img src="./default-portrait-1.webp" alt="六列测试图片一" /></p>
<p><img src="./default-portrait-2.webp" alt="六列测试图片二" /></p>
<p><img src="./default-portrait-3.webp" alt="六列测试图片三" /></p>
<p><img src="./feature-landscape-1.webp" alt="六列测试图片四" /></p>
<p><img src="./feature-landscape-2.webp" alt="六列测试图片五" /></p>
<p><img src="./feature-landscape-3.webp" alt="六列测试图片六" />
:::</p>
<h2>四列方形图片：1:1</h2>
<p>四张比例相同的方形图片是典型的四列布局。桌面端在一行内显示全部四张；平板折叠为两列，手机折叠为一列。</p>
<pre><code>:::grid{columns="4" aspect="1/1"}
![Square image description](./square-1.webp)

![Square image description](./square-2.webp)

![Square image description](./square-3.webp)

![Square image description](./square-4.webp)
:::
</code></pre>
<p>:::grid{columns="4" aspect="1/1"}
<img src="./square-1.webp" alt="方形图片一" /></p>
<p><img src="./square-2.webp" alt="方形图片二" /></p>
<p><img src="./square-3.webp" alt="方形图片三" /></p>
<p><img src="./square-4.webp" alt="方形图片四" />
:::</p>
<h2>六列横向图片：16:9</h2>
<p>六列横向布局适合缩略图预览、作品集和截图索引。即使原图比例略有差异，<code>cover</code> 也能一致地填满每张 <code>16/9</code> 卡片。</p>
<pre><code>:::grid{columns="6" aspect="16/9"}
![Landscape image description](./landscape-1.webp)

![Landscape image description](./landscape-2.webp)

![Landscape image description](./landscape-3.webp)

![Landscape image description](./landscape-4.webp)

![Landscape image description](./landscape-5.webp)

![Landscape image description](./landscape-6.webp)
:::
</code></pre>
<p>:::grid{columns="6" aspect="16/9"}
<img src="./landscape-1.webp" alt="横向图片一" /></p>
<p><img src="./landscape-2.webp" alt="横向图片二" /></p>
<p><img src="./landscape-3.webp" alt="横向图片三" /></p>
<p><img src="./landscape-4.webp" alt="横向图片四" /></p>
<p><img src="./landscape-5.webp" alt="横向图片五" /></p>
<p><img src="./landscape-6.webp" alt="横向图片六" />
:::</p>
<h2>三列纵向图片：3:4</h2>
<p>这一组六张纵向图片演示了人物、海报或手机截图的常见布局。图片组成两行三列，图注对齐到底部。</p>
<pre><code>:::grid{columns="3" aspect="3/4"}
![Portrait image description](./portrait-1.webp)

![Portrait image description](./portrait-2.webp)

![Portrait image description](./portrait-3.webp)

![Portrait image description](./portrait-4.webp)

![Portrait image description](./portrait-5.webp)

![Portrait image description](./portrait-6.webp)
:::
</code></pre>
<p>:::grid{columns="3" aspect="3/4"}
<img src="./portrait-1.webp" alt="纵向图片一" /></p>
<p><img src="./portrait-2.webp" alt="纵向图片二" /></p>
<p><img src="./portrait-3.webp" alt="纵向图片三" /></p>
<p><img src="./portrait-4.webp" alt="纵向图片四" /></p>
<p><img src="./portrait-5.webp" alt="纵向图片五" /></p>
<p><img src="./portrait-6.webp" alt="纵向图片六" />
:::</p>
<h2>边缘敏感内容：<code>cover</code> 与灯箱</h2>
<p>这些图片在边缘附近包含重要文字或细节。<code>cover</code> 能保持网格整齐，但可能裁掉这些边缘；点击图片可在灯箱中查看未裁剪的原图。对于边缘敏感图片，请使用清晰的图注，或改用下方的 <code>contain</code>。</p>
<pre><code>:::grid{columns="3" aspect="16/9" fit="cover"}
![Edge-critical content](./critical-1.webp "Open the lightbox to view the complete edge content")

![Edge-critical content](./critical-2.webp "Open the lightbox to view the complete edge content")

![Edge-critical content](./critical-3.webp "Open the lightbox to view the complete edge content")
:::
</code></pre>
<p>:::grid{columns="3" aspect="16/9" fit="cover"}
<img src="./critical-1.webp" alt="第一张边缘敏感图片" title="打开灯箱查看完整的边缘内容" /></p>
<p><img src="./critical-2.webp" alt="第二张边缘敏感图片" title="打开灯箱查看完整的边缘内容" /></p>
<p><img src="./critical-3.webp" alt="第三张边缘敏感图片" title="打开灯箱查看完整的边缘内容" />
:::</p>
<h2>极端比例与 <code>contain</code></h2>
<p>对于横幅、长截图及其他极端图片比例，<code>contain</code> 会显示完整原图。与 <code>cover</code> 不同，它可能留下主题背景空间，但绝不会裁剪内容。</p>
<pre><code>:::grid{columns="3" aspect="16/9" fit="contain"}
![Complete screenshot description](./wide-1.webp)

![Complete screenshot description](./wide-2.webp)

![Complete screenshot description](./wide-3.webp)
:::
</code></pre>
<p>:::grid{columns="3" aspect="16/9" fit="contain"}
<img src="./extreme-1.webp" alt="第一张极端比例图片" /></p>
<p><img src="./extreme-2.webp" alt="第二张极端比例图片" /></p>
<p><img src="./extreme-3.webp" alt="第三张极端比例图片" />
:::</p>
<h2>透明图片</h2>
<p>透明图片会露出卡片的主题背景。这个单列 <code>contain</code> 示例便于检查透明区域、原图边缘与灯箱行为。</p>
<pre><code>:::grid{columns="1" aspect="16/9" fit="contain"}
![Transparent image description](./transparent.webp)
:::
</code></pre>
<p>:::grid{columns="1" aspect="16/9" fit="contain"}
<img src="./transparent-1.webp" alt="透明背景测试图片" />
:::</p>
<h2>灯箱导航</h2>
<p>点击网格中任意图片即可打开 Fancybox 灯箱。在其中可以缩放、旋转、进入全屏、查看缩略图，并使用方向键导航。导航仅限于当前的 <code>:::grid</code> 容器：例如，点击"16:9 测试图片一"只会打开该节中另外两张横向图片。</p>
<p>同一文章中的普通 Markdown 图片仍会被单独处理；它们不会被加入任何网格画廊。</p>
<h2>检查清单</h2>
<ol>
<li>每个网格中的图片尺寸一致，图注显示在卡片下方。</li>
<li>图片在悬停时轻微缩放；点击后可缩放、旋转，并用键盘导航。</li>
<li>点击"16:9 测试图片一"时，灯箱仅能浏览该节中另外两张横向图片。</li>
<li>低于 768px 时，网格最多两列；低于 480px 时，为一列。</li>
<li>"四列与 <code>contain</code>"中的纵向图片完整可见，留有空白，未被裁剪。</li>
<li>五列与六列网格在宽屏上保持指定列数，随后按响应式规则折叠为两列或一列。</li>
</ol>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>Expressive Code 示例</title>
    <link href="https://xiaomai.l.cd/posts/%E4%BB%A3%E7%A0%81%E9%AB%98%E4%BA%AE%E7%A4%BA%E4%BE%8B/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E4%BB%A3%E7%A0%81%E9%AB%98%E4%BA%AE%E7%A4%BA%E4%BE%8B/</id>
    <published>2026-09-10T00:00:00.000Z</published>
    <updated>2026-09-10T00:00:00.000Z</updated>
    <summary>演示在 Markdown 中使用 Expressive Code 时代码块的外观。</summary>
    <content type="html"><![CDATA[<p>这里我们将了解使用 <a href="https://expressive-code.com/">Expressive Code</a> 时代码块的外观。所提供的示例基于官方文档，如需更多细节可参阅。</p>
<h2>Expressive Code</h2>
<h3>语法高亮</h3>
<p><a href="https://expressive-code.com/key-features/syntax-highlighting/">语法高亮</a></p>
<h4>常规语法高亮</h4>
<pre><code>console.log('This code is syntax highlighted!')
</code></pre>
<h4>渲染 ANSI 转义序列</h4>
<pre><code>ANSI colors:
- Regular: [31mRed[0m [32mGreen[0m [33mYellow[0m [34mBlue[0m [35mMagenta[0m [36mCyan[0m
- Bold:    [1;31mRed[0m [1;32mGreen[0m [1;33mYellow[0m [1;34mBlue[0m [1;35mMagenta[0m [1;36mCyan[0m
- Dimmed:  [2;31mRed[0m [2;32mGreen[0m [2;33mYellow[0m [2;34mBlue[0m [2;35mMagenta[0m [2;36mCyan[0m

256 colors (showing colors 160-177):
[38;5;160m160 [38;5;161m161 [38;5;162m162 [38;5;163m163 [38;5;164m164 [38;5;165m165[0m
[38;5;166m166 [38;5;167m167 [38;5;168m168 [38;5;169m169 [38;5;170m170 [38;5;171m171[0m
[38;5;172m172 [38;5;173m173 [38;5;174m174 [38;5;175m175 [38;5;176m176 [38;5;177m177[0m

Full RGB colors:
[38;2;34;139;34mForestGreen - RGB(34, 139, 34)[0m

Text formatting: [1mBold[0m [2mDimmed[0m [3mItalic[0m [4mUnderline[0m
</code></pre>
<h3>编辑器与终端边框</h3>
<p><a href="https://expressive-code.com/key-features/frames/">编辑器与终端边框</a></p>
<h4>代码编辑器边框</h4>
<pre><code>console.log('Title attribute example')
</code></pre>
<hr />
<pre><code>&lt;!-- src/content/index.html --&gt;
&lt;div&gt;File name comment example&lt;/div&gt;
</code></pre>
<h4>终端边框</h4>
<pre><code>echo "This terminal frame has no title"
</code></pre>
<hr />
<pre><code>Write-Output "This one has a title!"
</code></pre>
<h4>覆盖边框类型</h4>
<pre><code>echo "Look ma, no frame!"
</code></pre>
<hr />
<pre><code># Without overriding, this would be a terminal frame
function Watch-Tail { Get-Content -Tail 20 -Wait $args }
New-Alias tail Watch-Tail
</code></pre>
<h3>文本与行标记</h3>
<p><a href="https://expressive-code.com/key-features/text-markers/">文本与行标记</a></p>
<h4>标记整行与行范围</h4>
<pre><code>// Line 1 - targeted by line number
// Line 2
// Line 3
// Line 4 - targeted by line number
// Line 5
// Line 6
// Line 7 - targeted by range "7-8"
// Line 8 - targeted by range "7-8"
</code></pre>
<h4>选择行标记类型（mark、ins、del）</h4>
<pre><code>function demo() {
  console.log('this line is marked as deleted')
  // This line and the next one are marked as inserted
  console.log('this is the second inserted line')

  return 'this line uses the neutral default marker type'
}
</code></pre>
<h4>为行标记添加标签</h4>
<pre><code>// labeled-line-markers.jsx
&lt;button
  role="button"
  {...props}
  value={value}
  className={buttonClassName}
  disabled={disabled}
  active={active}
&gt;
  {children &amp;&amp;
    !active &amp;&amp;
    (typeof children === 'string' ? &lt;span&gt;{children}&lt;/span&gt; : children)}
&lt;/button&gt;
</code></pre>
<h4>在独立行上添加长标签</h4>
<pre><code>// labeled-line-markers.jsx
&lt;button
  role="button"
  {...props}

  value={value}
  className={buttonClassName}

  disabled={disabled}
  active={active}
&gt;

  {children &amp;&amp;
    !active &amp;&amp;
    (typeof children === 'string' ? &lt;span&gt;{children}&lt;/span&gt; : children)}
&lt;/button&gt;
</code></pre>
<h4>使用类 diff 语法</h4>
<pre><code>+this line will be marked as inserted
-this line will be marked as deleted
this is a regular line
</code></pre>
<hr />
<pre><code>--- a/README.md
+++ b/README.md
@@ -1,3 +1,4 @@
+this is an actual diff file
-all contents will remain unmodified
 no whitespace will be removed either
</code></pre>
<h4>将语法高亮与类 diff 语法结合</h4>
<pre><code>  function thisIsJavaScript() {
    // This entire block gets highlighted as JavaScript,
    // and we can still add diff markers to it!
-   console.log('Old code to be removed')
+   console.log('New and shiny code!')
  }
</code></pre>
<h4>标记行内的个别文本</h4>
<pre><code>function demo() {
  // Mark any given text inside lines
  return 'Multiple matches of the given text are supported';
}
</code></pre>
<h4>正则表达式</h4>
<pre><code>console.log('The words yes and yep will be marked.')
</code></pre>
<h4>转义正斜杠</h4>
<pre><code>echo "Test" &gt; /home/test.txt
</code></pre>
<h4>选择行内标记类型（mark、ins、del）</h4>
<pre><code>function demo() {
  console.log('These are inserted and deleted marker types');
  // The return statement uses the default marker type
  return true;
}
</code></pre>
<h3>自动换行</h3>
<p><a href="https://expressive-code.com/key-features/word-wrap/">自动换行</a></p>
<h4>为单个代码块配置自动换行</h4>
<pre><code>// Example with wrap
function getLongString() {
  return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}
</code></pre>
<hr />
<pre><code>// Example with wrap=false
function getLongString() {
  return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}
</code></pre>
<h4>配置折行缩进</h4>
<pre><code>// Example with preserveIndent (enabled by default)
function getLongString() {
  return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}
</code></pre>
<hr />
<pre><code>// Example with preserveIndent=false
function getLongString() {
  return 'This is a very long string that will most probably not fit into the available space unless the container is extremely wide'
}
</code></pre>
<h2>可折叠区块</h2>
<p><a href="https://expressive-code.com/plugins/collapsible-sections/">可折叠区块</a></p>
<pre><code>// All this boilerplate setup code will be collapsed
import { someBoilerplateEngine } from '@example/some-boilerplate'
import { evenMoreBoilerplate } from '@example/even-more-boilerplate'

const engine = someBoilerplateEngine(evenMoreBoilerplate())

// This part of the code will be visible by default
engine.doSomething(1, 2, 3, calcFn)

function calcFn() {
  // You can have multiple collapsed sections
  const a = 1
  const b = 2
  const c = a + b

  // This will remain visible
  console.log(`Calculation result: ${a} + ${b} = ${c}`)
  return c
}

// All this code until the end of the block will be collapsed again
engine.closeConnection()
engine.freeMemory()
engine.shutdown({ reason: 'End of example boilerplate code' })
</code></pre>
<h2>行号</h2>
<p><a href="https://expressive-code.com/plugins/line-numbers/">行号</a></p>
<h3>为单个代码块显示行号</h3>
<pre><code>// This code block will show line numbers
console.log('Greetings from line 2!')
console.log('I am on line 3')
</code></pre>
<hr />
<pre><code>// Line numbers are disabled for this block
console.log('Hello?')
console.log('Sorry, do you know what line I am on?')
</code></pre>
<h3>更改起始行号</h3>
<pre><code>console.log('Greetings from line 5!')
console.log('I am on line 6')
</code></pre>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>Mermaid 图表画廊</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E5%9B%BE%E8%A1%A8%E7%94%BB%E5%BB%8A/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E5%9B%BE%E8%A1%A8%E7%94%BB%E5%BB%8A/</id>
    <published>2026-09-02T00:00:00.000Z</published>
    <updated>2026-09-02T00:00:00.000Z</updated>
    <summary>汇集 Mermaid 图表，涵盖流程、交互、数据模型、排期与项目历程的示例画廊。</summary>
    <content type="html"><![CDATA[<p>Mermaid 能将 Markdown 中的文字描述转换为图表。下面的示例借助 XiaoMai 的内容工作流，演示技术文章与项目笔记中常用的图表类型。</p>
<h2>流程图</h2>
<p>流程图用于描述一个过程，包括判断分支以及回到较早步骤的路径。</p>
<pre><code>flowchart TD
    accTitle: 文章发布工作流
    accDescr: 文章经过撰写、校验、预览与构建后发布。校验失败会退回修订。
    Draft[撰写 Markdown] --&gt; Check{校验是否通过？}
    Check --&gt;|否| Revise[修订文章]
    Revise --&gt; Check
    Check --&gt;|是| Preview[本地预览]
    Preview --&gt; Build[构建静态页面]
    Build --&gt; Publish[发布]
</code></pre>
<h2>时序图</h2>
<p>时序图按时间顺序呈现参与者之间的协作。本例跟踪一次从请求到 Mermaid 渲染的 Swup 导航。</p>
<pre><code>sequenceDiagram
    accTitle: 站内导航后的图表渲染
    accDescr: 读者发起导航，Swup 替换文章内容，Mermaid 渲染器在新页面上增强图表。
    actor Reader
    participant Browser
    participant Swup
    participant Content as 文章区域
    participant Renderer as Mermaid 渲染器
    Reader-&gt;&gt;Browser: 打开另一篇文章
    Browser-&gt;&gt;Swup: 发起站内导航
    Swup-&gt;&gt;Content: 替换页面内容
    Swup--&gt;&gt;Renderer: Emit content:replace
    Renderer-&gt;&gt;Content: 查找 Mermaid 容器
    Renderer--&gt;&gt;Browser: 插入主题化 SVG
</code></pre>
<h2>实体关系图</h2>
<p>实体关系图用于建模结构化数据，以及作者、文章、标签与评论之间的关联。</p>
<pre><code>erDiagram
    accTitle: 博客内容关系
    accDescr: 作者撰写文章，文章收到评论，连接记录将文章关联到多个标签。
    AUTHOR ||--o{ POST : 写入
    POST ||--o{ COMMENT : 收到
    POST ||--o{ POST_TAG : 归类于
    TAG ||--o{ POST_TAG : 分组
    AUTHOR {
        string id PK
        string display_name
    }
    POST {
        string slug PK
        string title
        datetime published_at
        string author_id FK
    }
    COMMENT {
        string id PK
        string post_slug FK
        string body
    }
    TAG {
        string id PK
        string label
    }
    POST_TAG {
        string post_slug FK
        string tag_id FK
    }
</code></pre>
<h2>类图</h2>
<p>类图用于表达软件设计中的职责、公共方法以及依赖方向。</p>
<pre><code>classDiagram
    accTitle: Markdown 渲染模块
    accDescr: 内容管线使用 Mermaid 插件生成回退标记，随后客户端渲染器将其增强为 SVG。
    class ContentPipeline {
        +render(markdown)
        +collectMetadata()
    }
    class MermaidPlugin {
        +transform(codeFence)
        +createFallback()
    }
    class DiagramRenderer {
        +initialize()
        +renderAll()
        +refreshTheme()
    }
    class ThemeTokens {
        +primary
        +surface
        +outline
    }
    ContentPipeline --&gt; MermaidPlugin : 使用
    DiagramRenderer --&gt; MermaidPlugin : 增强输出
    DiagramRenderer --&gt; ThemeTokens : 读取
</code></pre>
<h2>状态图</h2>
<p>状态图展示对象的生命周期，以及推动其在各状态间跃迁的事件。</p>
<pre><code>stateDiagram-v2
    accTitle: 文章生命周期
    accDescr: 文章从draft经评审到发布，可能退回修订，最终归档。
    [*] --&gt; Draft
    Draft --&gt; InReview : 提交
    InReview --&gt; Draft : 请求修改
    InReview --&gt; Published : 批准
    Published --&gt; Draft : 撤回
    Published --&gt; Archived : 归档
    Archived --&gt; [*]
</code></pre>
<h2>XY 图表</h2>
<p>XY 图表结合柱状与折线，在同一坐标轴上比较数值与趋势。</p>
<pre><code>xychart-beta
    accTitle: 六周内容表现
    accDescr: 柱形展示归一化的每周发布量，折线展示归一化的阅读完成度。
    title "六周内容表现"
    x-axis "周" [1, 2, 3, 4, 5, 6]
    y-axis "相对得分" 0 --&gt; 100
    bar [36, 52, 44, 68, 76, 84]
    line [48, 55, 62, 61, 73, 81]
</code></pre>
<h2>饼图</h2>
<p>饼图以紧凑方式比较各分类在整体中所占的比重。</p>
<pre><code>pie showData
    accTitle: 文章主题占比
    accDescr: 工程占四成，设计系统占两成五，其余由指南与随笔分摊。
    title 文章主题占比
    "工程" : 40
    "设计系统" : 25
    "指南" : 20
    "随笔" : 15
</code></pre>
<h2>甘特图</h2>
<p>甘特图沿日历时间线排布任务、依赖关系与里程碑。</p>
<pre><code>gantt
    accTitle: 主题发布计划
    accDescr: 发布计划从需求与交互设计，经组件开发、测试，直至发布。
    title 主题发布计划
    dateFormat YYYY-MM-DD
    axisFormat %m/%d
    section 设计
    Confirm requirements :done, brief, 2024-05-06, 2d
    Refine interactions :done, interaction, after brief, 3d
    section 实现
    Develop components :active, components, after interaction, 6d
    Write examples :examples, after interaction, 4d
    section 验证
    Automated tests :tests, after components, 3d
    Release :milestone, release, after tests, 0d
</code></pre>
<h2>思维导图</h2>
<p>思维导图将一个中心主题展开为相关领域与支撑概念。</p>
<pre><code>mindmap
  root((XiaoMai))
    Content experience
      Markdown
      Search
      Diagrams
    Interface system
      M3E tokens
      Responsive layout
      Color schemes
    Engineering quality
      Astro Check
      Playwright
      Accessibility
</code></pre>
<h2>时间线</h2>
<p>时间线用于概括重要事件或阶段，无需给出精确的日历时长。</p>
<pre><code>timeline
    title Mermaid 支持演进
    管线设计 : 检测 Mermaid 围栏
                    : 保留源码回退
    客户端增强 : 按需加载运行时
                       : 应用主题令牌
    可靠性 : 支持 Swup 导航
                : 校验响应式与无障碍输出
</code></pre>
<h2>用户旅程图</h2>
<p>用户旅程图结合任务各阶段中的操作、参与者与体验评分。</p>
<pre><code>journey
    accTitle: 读者理解技术文章
    accDescr: 读者发现文章，将正文与图表结合以理解内容，随后探索相关主题。
    title 读者理解技术文章
    section 发现
      Browse the article list: 4: Reader
      Choose a topic: 5: Reader
    section 理解
      Read the article: 4: Reader
      Inspect a relationship diagram: 5: Reader
    section 续读
      Open a related article: 4: Reader
      Bookmark the page: 3: Reader
</code></pre>
<h2>Git 图</h2>
<p>Git 图展示功能分支在合并回主线之前的工作推进过程。</p>
<pre><code>gitGraph
    accTitle: Mermaid 特性分支历史
    accDescr: 特性分支在合并回主分支发布之前，新增渲染器与测试。
    commit id: "base"
    branch mermaid
    checkout mermaid
    commit id: "add-renderer"
    commit id: "add-tests"
    checkout main
    merge mermaid id: "merge-mermaid"
    commit id: "release"
</code></pre>
<h2>看板</h2>
<p>看板按工作流状态对任务分组，便于快速浏览当前进度。</p>
<pre><code>kanban
  backlog[待办]
    docs[撰写作者文档]
    examples[扩充示例数据]
  active[进行中]
    themes[验证主题适配]
  complete[已完成]
    fallback[源码回退]
    rendering[客户端渲染]
</code></pre>
<h2>桑基图</h2>
<p>桑基图用连线宽度表示流量或其他数量在节点之间的流动。</p>
<pre><code>sankey-beta
Landing,Reading,720
Discovery,Reading,430
Reading,Explore,360
Reading,Topic,210
Reading,External,140
</code></pre>
<p>每个示例都使用标准的 <code>mermaid</code> 代码围栏。服务端会保留可读的源码标记，浏览器则将其增强为遵循当前主题的 SVG。当主题切换或 Swup 导航到本文时，图表会重新渲染。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>Markdown 示例</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E7%A4%BA%E4%BE%8B/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E7%A4%BA%E4%BE%8B/</id>
    <published>2026-09-01T00:00:00.000Z</published>
    <updated>2026-09-01T00:00:00.000Z</updated>
    <summary>一个简单的 Markdown 博客文章示例。</summary>
    <content type="html"><![CDATA[<h1>一级标题</h1>
<p>段落之间用一个空行分隔。</p>
<p>第二段。<em>斜体</em>、<strong>粗体</strong> 和 <code>等宽字体</code>。无序列表
看起来像这样：</p>
<ul>
<li>这个</li>
<li>那个</li>
<li>另一个</li>
</ul>
<p>注意——先不论星号——真正的正文内容是从第 4 列开始的。</p>
<blockquote>
<p>引用块是
这样写的。</p>
<p>它们可以跨多个段落，
只要你愿意。</p>
</blockquote>
<p>用三个连字符表示破折号（em-dash）。用两个连字符表示范围（例如，“全部在
第 12--14 章”）。三个点 … 会被转换为省略号。支持 Unicode。☺</p>
<h2>二级标题</h2>
<p>下面是一个有序列表：</p>
<ol>
<li>第一项</li>
<li>第二项</li>
<li>第三项</li>
</ol>
<p>再次注意，真正的正文是从第 4 列开始的（距左侧 4 个字符）。
这里是一个代码示例：</p>
<pre><code># 让我重申一下……
for i in 1 .. 10 { do-something(i) }
</code></pre>
<p>正如你可能猜到的，缩进 4 个空格即可。顺便说一句，如果不想
缩进代码块，你也可以使用围栏代码块：</p>
<pre><code>define foobar() {
    print "Welcome to flavor country!";
}
</code></pre>
<p>（这样复制粘贴更方便）。你还可以可选地标记该围栏块，让 Pandoc 对其进行语法高亮：</p>
<pre><code>import time
# 快，数到十！
for i in range(10):
    #（但别太快）
    time.sleep(0.5)
    print i
</code></pre>
<h3>三级标题</h3>
<p>现在是一个嵌套列表：</p>
<ol>
<li>
<p>首先，准备这些食材：</p>
<ul>
<li>胡萝卜</li>
<li>芹菜</li>
<li>扁豆</li>
</ul>
</li>
<li>
<p>烧一些水。</p>
</li>
<li>
<p>把一切都倒进锅里，然后
按这个步骤来：</p>
<pre><code> find wooden spoon
 uncover pot
 stir
 cover pot
 balance wooden spoon precariously on pot handle
 wait 10 minutes
 goto first step (or shut off burner when done)
</code></pre>
<p>别碰木勺，否则它会掉下来。</p>
</li>
</ol>
<p>注意，文本始终对齐在 4 个空格的缩进处（包括
上面续写第 3 项的最后一行）。</p>
<p>这里有一个指向 <a href="http://foo.bar">某个网站</a> 的链接，一个指向 <a href="local-doc.html">本地
文档</a> 的链接，以及一个指向当前文档中
<a href="#an-h2-header">某个小节标题</a> 的链接。这里还有一个脚注 <a href="%E8%84%9A%E6%B3%A8%E6%96%87%E5%AD%97%E5%86%99%E5%9C%A8%E8%BF%99%E9%87%8C%E3%80%82">^1</a>。</p>
<p>表格可以这样写：</p>
<p>尺码 材质 颜色</p>
<hr />
<p>9 皮革 棕色
10 麻布 帆布 原色
11 玻璃 透明</p>
<p>Table: 鞋子、它们的尺码以及材质</p>
<p>（以上是表格的标题。）Pandoc 还支持
多行表格：</p>
<hr />
<p>关键词 文字</p>
<hr />
<p>红 日落、苹果，以及
其他红色或偏红
的事物。</p>
<p>绿 树叶、青草、青蛙，
以及那些不那么
容易拥有的事物。</p>
<hr />
<p>下面是一条水平分隔线。</p>
<hr />
<p>这是一个定义列表：</p>
<p>apples
: 适合做苹果酱。
oranges
: 柑橘类！
tomatoes
: tomatoe 里没有字母“e”。</p>
<p>再次，文本缩进 4 个空格。（在每个
术语/定义之间加一个空行，可以让内容更舒展。）</p>
<p>这是一个“行块”：</p>
<p>| 第一行
| 第二行
| 第三行</p>
<p>图片可以这样指定：</p>
<p>行内数学公式这样写：$\omega = d\phi / dt$。展示型
数学公式应单独占一行，并用双美元符号包裹：</p>
<p>$$I = \int \rho R^{2} dV$$</p>
<p>$$
\begin{equation*}
\pi
=3.1415926535
;8979323846;2643383279;5028841971;6939937510;5820974944
;5923078164;0628620899;8628034825;3421170679;\ldots
\end{equation*}
$$</p>
<p>注意，你可以对想原样显示的任意标点字符加反斜杠转义，例如：`foo`、*bar* 等。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>在文章中嵌入视频</title>
    <link href="https://xiaomai.l.cd/posts/%E8%A7%86%E9%A2%91%E5%B5%8C%E5%85%A5/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E8%A7%86%E9%A2%91%E5%B5%8C%E5%85%A5/</id>
    <published>2026-09-01T00:00:00.000Z</published>
    <updated>2026-09-01T00:00:00.000Z</updated>
    <summary>本文演示如何在博客文章中嵌入视频。</summary>
    <content type="html"><![CDATA[<p>只需从 YouTube 或其他平台复制嵌入代码，然后粘贴到 Markdown 文件中即可。</p>
<pre><code>---
title: Include Video in the Post
published: 2026-09-01
// ...
---

&lt;iframe width="100%" height="468" src="https://www.youtube.com/embed/5gIf0_xpFPI?si=N1WTorLKL0uwLsU_" title="YouTube video player" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
</code></pre>
<h2>Bilibili</h2>
<p>::bilibili{bvid="BV1yvBEBREfA" title="Bilibili 视频" p=1 preload="auto"}</p>
<h2>Bilibili</h2>
<p>::bilibili{bvid="BV1twbK6MEXn" title="Bilibili 视频" p=1 preload="auto"}</p>
<h2>ArtPlayer</h2>
<p>::artplayer{src="https://www.pexels.com/download/video/38538991/" title="Sintel 预告片" preload="auto"}</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>Audio Reader：日式动漫神秘语音</title>
    <link href="https://xiaomai.l.cd/posts/%E8%AF%AD%E9%9F%B3%E6%9C%97%E8%AF%BB/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E8%AF%AD%E9%9F%B3%E6%9C%97%E8%AF%BB/</id>
    <published>2026-08-29T00:00:00.000Z</published>
    <updated>2026-08-29T00:00:00.000Z</updated>
    <summary>一小批神秘的日式动漫语音片段，通过 Audio Reader 按需播放。</summary>
    <content type="html"><![CDATA[<p>这些简短的日文语音片段，仿佛是从某个动漫场景的边缘拾来的：一声戏谑的呼唤、一句明亮的问候、一阵轻笑，还有几句来路不明的台词。它们是情绪样本而非对话脚本，所以让声音本身去承载含义吧。</p>
<p>Audio Reader 会让它们保持安静，直到你选择收听。每个发音按钮只有在被按下后才会加载并播放其片段。</p>
<pre><code>:audio-reader[Clip title]{src="/assets/audio/filename.wav"}
</code></pre>
<h2>片段列表</h2>
<ul>
<li><strong>Baka（笨蛋）</strong>：:audio-reader[バカ]{src="/assets/audio/Baka.wav"}</li>
<li><strong>Ciallo</strong>：:audio-reader[Ciallo！！]{src="/assets/audio/Ciallo.wav"}</li>
<li><strong>Ehe（轻笑）</strong>：:audio-reader[玩笑般的语气]{src="/assets/audio/Ehe.wav"}</li>
<li><strong>Imoi（土味）</strong>：:audio-reader[イモい]{src="/assets/audio/Imoi.wav"}</li>
<li><strong>Zako（杂鱼）</strong>：:audio-reader[雑魚じゃん、雑魚雑魚]{src="/assets/audio/Zako.wav"}</li>
</ul>
<p><code>src</code> 必须使用站点根路径或 HTTPS URL，且指令标签不能为空。无效或不完整的指令会保持为普通 Markdown，不会加载 Audio Reader 资源。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
  <entry>
    <title>Markdown 剧透</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E5%89%A7%E9%80%8F/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E5%89%A7%E9%80%8F/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>在隐藏行内答案的同时，保持剧透内容在 XiaoMai Markdown 中可被访问。</summary>
    <content type="html"><![CDATA[<p>剧透用于隐藏一个简短的答案或情节细节，同时不将其从文档中移除。悬停、聚焦或激活原生控件即可揭示内容。</p>
<h2>行内细节</h2>
<p>答案是 :spoiler[<strong>42</strong>]，而这句话在其周围保持为普通 Markdown。</p>
<p>剧透可以包含 <code>行内代码</code> 以及 :spoiler[一条带 <strong>强调</strong> 的更长细节]。</p>
<h2>编写语法</h2>
<pre><code>The answer is :spoiler[42].
</code></pre>
<p>生成的 HTML 使用一个带有 <code>aria-expanded</code> 状态的原生按钮。即使没有 JavaScript，悬停和聚焦仍能揭示文字；可选的运行时额外提供点击与键盘切换。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 文件包含</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E6%96%87%E4%BB%B6%E5%8C%85%E5%90%AB/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E6%96%87%E4%BB%B6%E5%8C%85%E5%90%AB/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>构建期的 Markdown 文件与片段包含。</summary>
    <content type="html"><![CDATA[<p>XiaoMai 可以包含一个本地 Markdown 文件，或其中一段安全的片段。</p>
<p>&lt;!-- @include: src/content/snippets/include-example.md#public-api --&gt;</p>
<p>完整文件与行范围形式同样受支持：</p>
<pre><code>&lt;!-- @include: src/content/snippets/include-example.md --&gt;
&lt;!-- @include: src/content/snippets/include-example.md{1-4} --&gt;
&lt;!-- @include: src/content/snippets/include-example.md{5-} --&gt;
&lt;!-- @include: src/content/snippets/include-example.md{-4} --&gt;
</code></pre>
<p>位于围栏代码内部的包含注释会保持原样。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 标记高亮</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E6%A0%87%E8%AE%B0%E9%AB%98%E4%BA%AE/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E6%A0%87%E8%AE%B0%E9%AB%98%E4%BA%AE/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>在 XiaoMai Markdown 中使用标记驱动的 marker 语法高亮关键短语。</summary>
    <content type="html"><![CDATA[<p>标记高亮用于突出某个特定短语，而不会把周围的段落变成一个独立组件。它们在构建时渲染为原生的 <code>&lt;mark&gt;</code> 元素，并继承当前活动的 M3E 配色系统。</p>
<h2>默认强调</h2>
<p>当强调应由文章的主色承担时，使用 <code>==text==</code>。这对于 ==读者应当记住的一个决定== 很有用，同时他们可以继续阅读普通段落。</p>
<p>标记中可以包含 ==嵌套的 <strong>Markdown 强调</strong>==，当短语需要更强的层级时。</p>
<h2>语义化颜色</h2>
<p>当含义需要不同的色调角色时，使用后缀。可用的变体有 <code>primary</code>、<code>secondary</code>、<code>tertiary</code>、<code>error</code> 和 <code>tip</code>。</p>
<ul>
<li>==主色将短语连接到当前主题=={.primary}</li>
<li>==次色让一个支撑性的区分保持低调=={.secondary}</li>
<li>==第三色添加一种独立的编辑信号=={.tertiary}</li>
<li>==错误色标识需要修正的状况=={.error}</li>
<li>==提示色突出实用建议=={.tip}</li>
</ul>
<h2>编写语法</h2>
<pre><code>==Primary marker==

==Secondary marker=={.secondary}
==Tertiary marker=={.tertiary}
==Error marker=={.error}
==Tip marker=={.tip}
</code></pre>
<p>诸如 <code>==literal marker syntax==</code> 这样的行内代码以及围栏示例会保持原样，因此文档可以解释该语法而不触发它。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 缩写</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E7%BC%A9%E5%86%99/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E7%BC%A9%E5%86%99/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>一次性定义常用缩写，并在普通文章正文中保留其完整含义。</summary>
    <content type="html"><![CDATA[<p>缩写让技术写作保持紧凑，同时为需要完整术语的读者保留其全称。被定义的术语会渲染为原生的 <code>abbr</code> 元素，其含义可在悬停时查看，也能被辅助技术读取。</p>
<h2>在语境中</h2>
<p>SSR 优先（SSR-first）的输出会在 JavaScript 运行前就让初始文档可见。在衡量其阅读体验时，LCP 和 CLS 能揭示首屏可见内容是否足够快且稳定。</p>
<p>缩写也可以出现在 <strong>SSR</strong> 这类普通 Markdown 旁边，但诸如 <code>SSR</code> 这样的字面代码以及像 <a href="https://web.dev/articles/lcp">LCP 文档</a> 这样的链接不会被改动。</p>
<h2>定义术语</h2>
<p>将定义放在同一篇 Markdown 文档的任意位置。它们不会作为可见段落渲染，只有该文章中匹配的术语才会获得语义化的缩写处理。</p>
<pre><code>*[SSR]: Server-Side Rendering
*[LCP]: Largest Contentful Paint
*[CLS]: Cumulative Layout Shift

SSR makes an HTML response available before client code runs.
</code></pre>
<p>*[SSR]: 服务端渲染（Server-Side Rendering）
*[LCP]: 最大内容绘制（Largest Contentful Paint）
*[CLS]: 累积布局偏移（Cumulative Layout Shift）</p>
<h2>编写边界</h2>
<p>术语必须以字母或数字开头，可包含字母、数字、句点、下划线、加号和连字符。每个定义仅适用于当前文章；无效或重复的定义会保持为普通 Markdown，而不会静默替换另一个术语。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 选项组</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E9%80%89%E9%A1%B9%E7%BB%84/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E9%80%89%E9%A1%B9%E7%BB%84/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>以紧凑、同步的 M3E 选项组呈现相关的 Markdown 备选方案。</summary>
    <content type="html"><![CDATA[<p>选项组把等价的操作说明放在一起，而无需重复周围的解释。每个选项都接受完整的块级 Markdown，而所选的值还能与同一页面上的另一个组同步。</p>
<h2>选择包管理器</h2>
<p>使用 <code>@tab:active</code> 选择初始选项。<code>#</code> 后面的后缀提供一个稳定值，而不改变可见标题。</p>
<p>::: tabs#package-manager</p>
<p>@tab npm</p>
<p>使用 npm 安装该包：</p>
<pre><code>npm install astro
</code></pre>
<p>@tab:active <strong>pnpm</strong>#pnpm</p>
<p>使用 pnpm 安装该包：</p>
<pre><code>pnpm.cmd add astro
</code></pre>
<p>@tab Bun#bun</p>
<p>使用 Bun 安装该包：</p>
<pre><code>bun add astro
</code></pre>
<p>:::</p>
<h2>运行项目</h2>
<p>这个组共享 <code>package-manager</code> 这个 id。在上面选择一个选项会更新下方匹配的命令，并在下次访问时记住该选择。</p>
<p>::: tabs#package-manager</p>
<p>@tab npm</p>
<pre><code>npm run dev
</code></pre>
<p>@tab pnpm</p>
<pre><code>pnpm.cmd dev
</code></pre>
<p>@tab Bun#bun</p>
<pre><code>bun run dev
</code></pre>
<p>:::</p>
<h2>多种备选方案</h2>
<p>较长的选项行保持在一行内，并在窄屏时于自身导航区域内滚动。</p>
<p>::: tabs</p>
<p>@tab 本地工作站</p>
<p>开发某个功能时，使用本地工具链。</p>
<p>@tab 托管预览环境</p>
<p>发布一个临时预览供审阅。</p>
<p>@tab 持续集成</p>
<p>针对每一次变更运行确定性校验。</p>
<p>@tab 生产部署</p>
<p>将经验证的产物提升到生产环境。</p>
<p>@tab 离线恢复流程</p>
<p>当网络不可用时，从本地产物恢复。</p>
<p>:::</p>
<h2>编写语法</h2>
<pre><code>::: tabs#package-manager

@tab npm

Use npm instructions here.

@tab:active **pnpm**#pnpm

Use pnpm instructions here.

:::
</code></pre>
<p>每个组至少需要两个 <code>@tab</code> 区块，且每个区块都需要有与标记之间以空行分隔的正文内容。无效或不完整的组会作为普通 Markdown 保持可读。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown collapse-panels</title>
    <link href="https://xiaomai.l.cd/posts/%E6%8A%98%E5%8F%A0%E9%9D%A2%E6%9D%BF/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E6%8A%98%E5%8F%A0%E9%9D%A2%E6%9D%BF/</id>
    <published>2026-08-28T00:00:00.000Z</published>
    <updated>2026-08-28T00:00:00.000Z</updated>
    <summary>将可选的 Markdown 内容分组为紧凑、无障碍的 M3E collapse-panels。</summary>
    <content type="html"><![CDATA[<p>collapse-panels把相关的可选细节放在一个紧凑的组里。标题与正文保留行内和块级 Markdown，而原生的折叠语义让每个面板都无需客户端 JavaScript 即可使用。</p>
<h2>独立面板</h2>
<p>默认情况下，各项独立展开。在标题前加 <code>:+</code> 可让该项初始展开，或加 <code>:-</code> 在组使用 <code>expand</code> 时保持关闭。</p>
<p>::: collapse</p>
<ul>
<li>
<p><strong>包要求</strong></p>
<p>使用 Node.js 22 或更高版本，并在安装包之前启用 Corepack。</p>
</li>
<li>
<p>:+ 安装依赖</p>
<p>从仓库根目录运行工作区的包命令。</p>
<pre><code>pnpm.cmd install
</code></pre>
</li>
<li>
<p>校验命令</p>
<p>在构建生产输出之前检查内容管线。</p>
<ul>
<li><code>pnpm.cmd check:manifest</code></li>
<li><code>npx.cmd astro check</code>
:::</li>
</ul>
</li>
</ul>
<h2>手风琴模式</h2>
<p>当只应保留一个展开项时，添加 <code>accordion</code>。浏览器会直接对原生折叠元素分组，因此打开另一项会在无需注水的情况下关闭前一项。</p>
<p>::: collapse accordion expand</p>
<ul>
<li>
<p><code>expand</code> 在这里有什么作用？</p>
<p>当没有任何项带有 <code>:+</code> 标记时，它会初始展开第一项。</p>
</li>
<li>
<p>标题可以包含 Markdown 吗？</p>
<p>可以。标题支持行内 <strong>强调</strong> 和 <code>代码</code>，而面板正文支持完整的块级 Markdown。</p>
</li>
<li>
<p>在窄屏上会发生什么？</p>
<p>内容内边距会变紧凑，长文本会换行，嵌入的代码保留自身的水平滚动区域。
:::</p>
</li>
</ul>
<h2>编写语法</h2>
<pre><code>::: collapse accordion
- :+ First title

  First panel content.

- Second title with `code`

  Second panel content.
:::
</code></pre>
<p>容器必须恰好包含一个顶层无序列表。每个项都需要有标题段落、一个空行以及正文内容。无效或混合的输入会保持为普通可读的 Markdown 列表。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 步骤</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E6%AD%A5%E9%AA%A4/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E6%AD%A5%E9%AA%A4/</id>
    <published>2026-08-27T00:00:00.000Z</published>
    <updated>2026-08-27T00:00:00.000Z</updated>
    <summary>在 XiaoMai 中以紧凑、无障碍的步骤流呈现顺序化操作说明。</summary>
    <content type="html"><![CDATA[<p>当操作的顺序很重要时，使用 Steps 组件。该组件保持文章的阅读流不被打断：一条安静的编号轨道提供定位，而标题、段落、链接、列表和代码仍保留其原生的 Markdown 角色。</p>
<h2>有序列表语法</h2>
<p>将一个 Markdown 有序列表包裹在 <code>:::steps</code> 容器中。每个顶层列表项成为一步。</p>
<pre><code>:::steps[Production deployment]
1. **Clone and prepare the workspace**

   Clone the repository and enter the project directory.

   ```powershell
   git clone https://github.com/LyraVoid/XiaoMai.git
   Set-Location XiaoMai
   ```

2. **Install dependencies**

   Use the repository's pinned package manager.

   ```powershell
   pnpm.cmd install
   ```

3. **Run project checks**

   Confirm Astro diagnostics and TypeScript checks pass.

   ```powershell
   npx.cmd astro check
   pnpm.cmd type-check
   ```

4. **Build the production site**

   Generate the static site and search index.

   ```powershell
   pnpm.cmd build
   ```
:::
</code></pre>
<p>:::steps[生产部署]</p>
<ol>
<li>
<p><strong>克隆并准备工作区</strong></p>
<p>克隆仓库并进入项目目录。</p>
<pre><code>git clone https://github.com/LyraVoid/XiaoMai.git
Set-Location XiaoMai
</code></pre>
</li>
<li>
<p><strong>安装依赖</strong></p>
<p>使用仓库锁定的包管理器。</p>
<pre><code>pnpm.cmd install
</code></pre>
</li>
<li>
<p><strong>运行项目检查</strong></p>
<p>确认 Astro 诊断与 TypeScript 检查通过。</p>
<pre><code>npx.cmd astro check
pnpm.cmd type-check
</code></pre>
</li>
<li>
<p><strong>构建生产站点</strong></p>
<p>生成静态站点与搜索索引。</p>
<pre><code>pnpm.cmd build
</code></pre>
</li>
</ol>
<p>:::</p>
<h2>选项</h2>
<ul>
<li><code>:::steps[标题]</code> 或 <code>title="标题"</code> 会添加可见标签与无障碍名称。</li>
<li><code>start=4</code> 改变首个显示的步号。</li>
<li>容器必须恰好包含一个有序列表。无效或混合的输入会保持为普通可读的 Markdown，而不会被启发式地解释。</li>
<li>渲染在站点构建阶段完成，不引入任何客户端 JavaScript 或网络请求。</li>
</ul>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>content-annotations</title>
    <link href="https://xiaomai.l.cd/posts/%E5%86%85%E5%AE%B9%E6%B3%A8%E9%87%8A/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E5%86%85%E5%AE%B9%E6%B3%A8%E9%87%8A/</id>
    <published>2026-08-27T00:00:00.000Z</published>
    <updated>2026-08-27T00:00:00.000Z</updated>
    <summary>在不打断阅读流的前提下，为 XiaoMai 文章添加紧凑、无障碍的补充说明。</summary>
    <content type="html"><![CDATA[<p>content-annotations把支撑性的上下文放在句子附近，又不把它直接放进阅读流中。点击小注释标记即可展开其内容。</p>
<h2>基本语法</h2>
<p>在普通正文中添加 <code>[+label]</code> 引用，然后在同一文章的其他位置定义对应的注释。</p>
<pre><code>Astro renders most of a page ahead of time and hydrates **interactive islands** [+islands] only when they need to become interactive.

[+islands]:
  An island is an interactive UI component surrounded by static HTML. This keeps the default page lightweight while preserving focused interactivity.
</code></pre>
<p>Astro 会预先渲染页面的大部分内容，并仅在<strong>交互式孤岛</strong> [+islands] 需要变为交互时才为其注水。</p>
<p>[+islands]:
孤岛是被静态 HTML 包围的交互式 UI 组件。这让默认页面保持轻量，同时保留聚焦的交互能力。</p>
<h2>富文本内容</h2>
<p>定义中可以包含段落、强调、链接、列表和行内代码 <a href="**%E7%BC%96%E5%86%99%E5%BB%BA%E8%AE%AE**">+rich-note</a>，而周围的句子照常继续。</p>
<ul>
<li>让首句自成一体。</li>
<li>当读者可能需要原始来源时，使用链接。</li>
<li>优先使用简洁的示例，例如 <code>client:visible</code>。</li>
</ul>
<p>完整模型请参阅 <a href="https://docs.astro.build/en/concepts/islands/">Astro 孤岛文档</a>。</p>
<h2>多个定义</h2>
<p>重复使用同一个标签 <a href="%E4%BB%8E%E4%BC%9A%E6%94%B9%E5%8F%98%E8%AF%BB%E8%80%85%E4%B8%8B%E4%B8%80%E6%AD%A5%E8%A1%8C%E5%8A%A8%E7%9A%84%E5%86%B3%E7%AD%96%E5%BC%80%E5%A7%8B%E3%80%82">+review</a>，在一个标记后呈现一组相关的简短注释。</p>
<p>诸如 <code>[+missing]</code> 之类的未定义引用会保持为普通文本，因此未完成的注释永远不会产生一个空控件。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown admonitions</title>
    <link href="https://xiaomai.l.cd/posts/%E6%8F%90%E7%A4%BA%E6%A1%86/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/%E6%8F%90%E7%A4%BA%E6%A1%86/</id>
    <published>2026-08-27T00:00:00.000Z</published>
    <updated>2026-08-27T00:00:00.000Z</updated>
    <summary>使用 XiaoMai 的 M3E Markdown 容器呈现说明、警告与可选细节。</summary>
    <content type="html"><![CDATA[<p>admonitions在保持文章阅读流的同时，让支撑信息在视觉上有所区分。每种形式都在服务端渲染，并使用同一个紧凑的 M3E 组件。</p>
<h2>语义变体</h2>
<p>::: note 部署上下文
带空格的形式接受纯自定义标题，同时仍与引用语法兼容。
:::</p>
<p>:::info
将信息块用于帮助读者理解周围章节的中性上下文。
:::</p>
<p>:::tip[已有的 <strong>label</strong> 语法]
原始的方括号标签仍然可用，且可包含行内 Markdown 强调。
:::</p>
<blockquote>
<p>[!IMPORTANT]
GitHub Alert 语法会进入同一个渲染器，因此已有文章保持统一的可视语言。</p>
</blockquote>
<p>:::warning
运行生产构建前，请检查环境变量。
:::</p>
<p>:::caution
不要随示例一起发布凭据、本地配置或私钥。
:::</p>
<h2>可选细节</h2>
<p>::: details 检查完整命令
该折叠使用原生浏览器语义，无需客户端 JavaScript 即可保持键盘可达性。</p>
<pre><code>npx.cmd astro check
pnpm.cmd build
</code></pre>
<ul>
<li>它初始为关闭状态。</li>
<li>长代码可在自身代码块内滚动。</li>
<li>在窄屏上，容器保持在文章宽度内。
:::</li>
</ul>
<h2>编写语法</h2>
<pre><code>:::note[Existing title syntax]
Content
:::

::: warning Plume-compatible title syntax
Content
:::

&gt; [!TIP]
&gt; GitHub Alert syntax

::: details Optional content
Hidden until the reader opens it.
:::
</code></pre>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>MDX 集成与 M3E 原子组件</title>
    <link href="https://xiaomai.l.cd/posts/mdx-%E9%9B%86%E6%88%90%E4%B8%8E%E5%8E%9F%E5%AD%90%E7%BB%84%E4%BB%B6/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/mdx-%E9%9B%86%E6%88%90%E4%B8%8E%E5%8E%9F%E5%AD%90%E7%BB%84%E4%BB%B6/</id>
    <published>2026-08-20T00:00:00.000Z</published>
    <updated>2026-08-20T00:00:00.000Z</updated>
    <summary>在 XiaoMai 中使用 MDX、Svelte 5 交互式孤岛与 Material 3 Expressive 设计令牌编写富交互文章的完整指南。</summary>
    <content type="html"><![CDATA[<p>:::tip
<strong>MDX（Markdown + JSX）</strong> 弥合了静态写作与应用程序界面之间的鸿沟。在 XiaoMai 中，作者可以在文章正文中无缝混合动态逻辑、响应式的 Svelte 5 组件以及 Material 3 设计令牌。
:::</p>
<h2>1. Markdown 与 MDX 能力矩阵</h2>
<table>
<thead>
<tr>
<th>特性</th>
<th>标准 Markdown（<code>.md</code>）</th>
<th>XiaoMai MDX（<code>.mdx</code>）</th>
<th>执行模式</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>排版与结构</strong></td>
<td>完整支持</td>
<td>完整支持</td>
<td>静态 SSR</td>
</tr>
<tr>
<td><strong>代码高亮</strong></td>
<td>行号、边框、可折叠</td>
<td>行号、边框、可折叠</td>
<td>静态 SSR（Expressive Code）</td>
</tr>
<tr>
<td><strong>图表与数学</strong></td>
<td>Mermaid、KaTeX</td>
<td>Mermaid、KaTeX</td>
<td>客户端增强</td>
</tr>
<tr>
<td><strong>admonitions Admonitions</strong></td>
<td>Note、Tip、Important、Warning、Caution</td>
<td>Note、Tip、Important、Warning、Caution</td>
<td>静态 SSR</td>
</tr>
<tr>
<td><strong>M3E 展示原子</strong></td>
<td>不可用</td>
<td>直接集成（``、<code>&lt;Skeleton&gt;</code>）</td>
<td>纯 SSR（零客户端 JS）</td>
</tr>
<tr>
<td><strong>Svelte 5 响应式孤岛</strong></td>
<td>不可用</td>
<td>按需注水（<code>&lt;Button&gt;</code>、<code>&lt;Switch&gt;</code>）</td>
<td><code>client:visible</code> 惰性注水</td>
</tr>
<tr>
<td><strong>反馈与加载原子</strong></td>
<td>不可用</td>
<td>动画形变（<code>&lt;LoadingIndicator&gt;</code>）</td>
<td><code>client:visible</code> 响应式</td>
</tr>
<tr>
<td><strong>动态 JSX 表达式</strong></td>
<td>不可用</td>
<td>原生求值（<code>{authorInfo.ui}</code>）</td>
<td>编译期 / 客户端</td>
</tr>
</tbody>
</table>
<hr />
<h2>2. 动态表达式与数据映射</h2>
<p>MDX 允许在文件顶部使用 <code>export const</code> 声明作用域常量，它们可以行内求值或跨模板映射：</p>
<ul>
<li><strong>核心框架</strong>：{authorInfo.framework}</li>
<li><strong>UI 引擎</strong>：{authorInfo.ui}</li>
<li><strong>设计令牌</strong>：{authorInfo.tokens}</li>
<li><strong>架构模式</strong>：{authorInfo.architecture}</li>
</ul>
<p>数组与集合可以动态渲染为网格布局：</p>
<p>&lt;div class="grid grid-cols-1 md:grid-cols-2 gap-4 my-6"&gt;
{showcaseItems.map((item, idx) =&gt; (
&lt;div key={item.name} class="p-4 rounded-xl border border-[var(--outline-variant)] bg-[var(--surface-container-low)]"&gt;
&lt;div class="flex items-center gap-2 mb-1"&gt;
&lt;span class="w-6 h-6 rounded-full bg-[var(--primary)] text-[var(--on-primary)] text-xs flex items-center justify-center font-bold"&gt;
{idx + 1}
&lt;/span&gt;
&lt;span class="font-bold text-[var(--on-surface)]"&gt;{item.name}&lt;/span&gt;
&lt;/div&gt;
&lt;p class="text-sm text-[var(--on-surface-variant)] m-0"&gt;{item.desc}&lt;/p&gt;
&lt;/div&gt;
))}
&lt;/div&gt;</p>
<hr />
<h2>3. M3E 展示与布局原语（仅 SSR）</h2>
<p>按照 XiaoMai 的组件架构（<code>docs/atomic-structure.md</code>），无状态展示组件会输出干净、无障碍的语义化 HTML，且不带来任何客户端运行时开销。</p>
<h3>3.1 卡片容器（<code>Card.svelte</code>）</h3>
<p>&lt;div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-6"&gt;
&lt;Card variant="filled" class="!p-5"&gt;
&lt;div class="font-bold text-[var(--primary)] mb-2"&gt;填充卡片&lt;/div&gt;
&lt;div class="text-sm text-[var(--on-surface-variant)]"&gt;默认容器背景，无悬浮阴影。适合分组内容块。&lt;/div&gt;</p>
<pre><code>&lt;div class="font-bold text-[var(--primary)] mb-2"&gt;悬浮卡片&lt;/div&gt;
&lt;div class="text-sm text-[var(--on-surface-variant)]"&gt;一级容器高度，附带交互状态分层以提升视觉焦点。&lt;/div&gt;



&lt;div class="font-bold text-[var(--primary)] mb-2"&gt;描边卡片&lt;/div&gt;
&lt;div class="text-sm text-[var(--on-surface-variant)]"&gt;清晰的 1px 描边边界，在中性表面上提供干净的分割。&lt;/div&gt;
</code></pre>
<p>&lt;/div&gt;</p>
<h3>3.2 强调条与徽标（<code>AccentBar</code> 与 <code>Badge</code>）</h3>
<p>&lt;div class="flex items-center gap-4 my-4 p-4 rounded-lg bg-[var(--surface-container-high)]"&gt;</p>
<p>&lt;div class="flex-1"&gt;
&lt;span class="font-bold text-lg"&gt;系统公告&lt;/span&gt;
&lt;p class="text-xs text-[var(--on-surface-variant)] m-0"&gt;将 AccentBar 与 Badge 组合，构建醒目的视觉提示&lt;/p&gt;
&lt;/div&gt;
M3E v0.192
&lt;/div&gt;</p>
<h3>3.3 骨架占位（<code>Skeleton.svelte</code>）</h3>
<p>用于预览布局骨架或搭建异步状态原型：</p>
<p>&lt;div class="flex flex-col gap-3 my-6 p-5 rounded-xl border border-[var(--outline-variant)] bg-[var(--surface-container-low)]"&gt;
&lt;div class="flex items-center gap-3"&gt;</p>
<pre><code>&lt;div class="flex flex-col gap-1.5 flex-1"&gt;
  
  
&lt;/div&gt;
</code></pre>
<p>&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<hr />
<h2>4. 反馈与加载指示器</h2>
<p>XiaoMai 提供高保真的 Material 3 Expressive 动效与反馈原子：</p>
<h3>4.1 形变动加载指示器（<code>LoadingIndicator.svelte</code>）</h3>
<p>基于 <code>androidx.graphics.shapes</code> 多边形形变实现，提供平滑的弹簧插值七形状动画：</p>
<p>&lt;div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-6 p-6 rounded-2xl bg-[var(--surface-container)] border border-[var(--outline-variant)] text-center"&gt;
&lt;div class="flex flex-col items-center gap-2"&gt;
&lt;div class="h-16 flex items-center justify-center"&gt;</p>
<pre><code>&lt;/div&gt;
&lt;span class="text-xs text-[var(--on-surface-variant)]"&gt;不确定形状形变&lt;/span&gt;
</code></pre>
<p>&lt;/div&gt;</p>
<p>&lt;div class="flex flex-col items-center gap-2"&gt;
&lt;div class="h-16 flex items-center justify-center"&gt;</p>
<pre><code>&lt;/div&gt;
&lt;span class="text-xs text-[var(--on-surface-variant)]"&gt;内含圆形变体&lt;/span&gt;
</code></pre>
<p>&lt;/div&gt;</p>
<p>&lt;div class="flex flex-col items-center gap-2"&gt;
&lt;div class="h-16 flex items-center justify-center"&gt;</p>
<pre><code>&lt;/div&gt;
&lt;span class="text-xs text-[var(--on-surface-variant)]"&gt;确定进度（68%）&lt;/span&gt;
</code></pre>
<p>&lt;/div&gt;
&lt;/div&gt;</p>
<h3>4.2 线性与不确定进度（<code>ProgressIndicator.svelte</code>）</h3>
<p>&lt;div class="flex flex-col gap-4 my-6 p-6 rounded-2xl bg-[var(--surface-container)] border border-[var(--outline-variant)]"&gt;
&lt;div class="flex flex-col gap-2"&gt;
&lt;div class="flex justify-between text-xs text-[var(--on-surface-variant)]"&gt;
&lt;span&gt;管线编译&lt;/span&gt;
&lt;span&gt;80%&lt;/span&gt;
&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div class="flex flex-col gap-2 mt-2"&gt;
&lt;div class="text-xs text-[var(--on-surface-variant)]"&gt;连续双线动画&lt;/div&gt;</p>
<p>&lt;/div&gt;
&lt;/div&gt;</p>
<hr />
<h2>5. 交互式 Svelte 5 孤岛</h2>
<p>使用 <code>client:visible</code> 声明的组件在进入视口时，会通过 <code>IntersectionObserver</code> 惰性注水：</p>
<h3>5.1 按钮矩阵（<code>Button.svelte</code>）</h3>
<p>&lt;div class="flex flex-wrap items-center gap-3 my-6 p-4 rounded-xl border border-[var(--outline-variant)]"&gt;
填充按钮
悬浮
色调按钮
描边
文本按钮
&lt;/div&gt;</p>
<h3>5.2 筛选芯片与分段按钮（<code>Chips</code> 与 <code>SegmentedButton</code>）</h3>
<p>&lt;div class="flex flex-col gap-4 my-6 p-6 rounded-2xl bg-[var(--surface-container)] border border-[var(--outline-variant)]"&gt;
&lt;div&gt;
&lt;div class="text-xs font-bold text-[var(--on-surface-variant)] mb-2"&gt;M3E 筛选芯片&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div&gt;
&lt;div class="text-xs font-bold text-[var(--on-surface-variant)] mb-2"&gt;分段控件&lt;/div&gt;</p>
<p>&lt;/div&gt;
&lt;/div&gt;</p>
<h3>5.3 开关、复选框与滑块（<code>Switch</code>、<code>Checkbox</code>、<code>Slider</code>）</h3>
<p>&lt;div class="flex flex-col gap-4 my-6 p-6 rounded-2xl bg-[var(--surface-container)] border border-[var(--outline-variant)]"&gt;
&lt;div class="flex items-center justify-between"&gt;
&lt;span class="font-bold text-sm"&gt;带状态图标的开关&lt;/span&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div class="flex items-center justify-between"&gt;
&lt;span class="font-bold text-sm"&gt;选择复选框&lt;/span&gt;
&lt;div class="flex items-center gap-4"&gt;</p>
<pre><code>&lt;/div&gt;
</code></pre>
<p>&lt;/div&gt;</p>
<p>&lt;div class="flex flex-col gap-2"&gt;
&lt;span class="font-bold text-sm"&gt;色相频谱滑块&lt;/span&gt;</p>
<p>&lt;/div&gt;
&lt;/div&gt;</p>
<h3>5.4 输入控件（<code>TextField.svelte</code>）</h3>
<p>&lt;div class="grid grid-cols-1 md:grid-cols-2 gap-4 my-6"&gt;</p>
<p>&lt;/div&gt;</p>
<hr />
<h2>6. Markdown 扩展兼容性</h2>
<p>XiaoMai 的 SSOT 统一插件管线保持了与所有 Markdown 扩展的完全兼容：</p>
<h3>6.1 GitHub 仓库卡片</h3>
<p>::github{repo="saicaca/fuwari"}</p>
<h3>6.2 Mermaid 架构图</h3>
<pre><code>flowchart TD
    MDX[MDX 源入口] --&gt; Compiler["@astrojs/mdx 编译器"]
    Compiler --&gt; Plugins["Remark / Rehype SSOT 管线"]
    Plugins --&gt; Islands["Svelte 5 交互式孤岛"]
    Islands --&gt; Swup["Swup 客户端导航外壳"]
    Swup --&gt; Screen["M3E 表现式文章视图"]
</code></pre>
<h3>6.3 数学表达式（LaTeX / KaTeX）</h3>
<p>行内公式：质能等价 $E = mc^2$ 与高斯积分 $\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$。</p>
<p>块级公式：</p>
<p>$$
\mathcal{L}<em>{M3E} = \sum</em>{i=1}^{N} \left( \text{Token}_i \cdot \text{ContrastRatio} \right) + \lambda |\text{MotionElegance}|
$$</p>
<hr />
<h2>7. 总结</h2>
<p>MDX 的原生集成让技术作者能够构建丰富、交互式的文档，同时保留 XiaoMai 极快的静态性能。所有组件都遵循 Material 3 Expressive 令牌设计体系，确保一致性、无障碍与视觉和谐。</p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="指南"/>
  </entry>
  <entry>
    <title>Markdown 扩展功能</title>
    <link href="https://xiaomai.l.cd/posts/markdown-%E6%89%A9%E5%B1%95%E5%8A%9F%E8%83%BD/" rel="alternate" type="text/html"/>
    <id>https://xiaomai.l.cd/posts/markdown-%E6%89%A9%E5%B1%95%E5%8A%9F%E8%83%BD/</id>
    <published>2026-08-01T00:00:00.000Z</published>
    <updated>2026-08-29T00:00:00.000Z</updated>
    <summary>了解更多 Fuwari 中的 Markdown 功能</summary>
    <content type="html"><![CDATA[<h2>GitHub 仓库卡片</h2>
<p>你可以添加动态卡片来链接到 GitHub 仓库，页面加载时，仓库信息会从 GitHub API 拉取。</p>
<p>::github{repo="Fabrizz/MMM-OnSpotify"}</p>
<p>使用代码 <code>::github{repo="&lt;owner&gt;/&lt;repo&gt;"}</code> 创建 GitHub 仓库卡片。</p>
<pre><code>::github{repo="saicaca/fuwari"}
</code></pre>
<h2>Mermaid 图表</h2>
<p>围栏的 <code>mermaid</code> 代码块会渲染为图表，并跟随当前的配色方案。</p>
<pre><code>flowchart LR
    accTitle: Markdown 渲染管线
    accDescr: Markdown 源码被转换为语义化 HTML，随后增强为主题化 SVG 图表。
    A[Markdown 源码] --&gt; B[Astro 内容管线]
    B --&gt; C[语义化 HTML]
    C --&gt; D[主题化图表]
</code></pre>
<h2>admonitions（Admonitions）</h2>
<p>支持以下几种admonitions：<code>note</code> <code>tip</code> <code>important</code> <code>warning</code> <code>caution</code></p>
<p>:::note
提示用户应当留意的信息，即使只是略读也应注意到。
:::</p>
<p>:::tip
帮助用户更顺利完成的选填信息。
:::</p>
<p>:::important
用户成功所必需的关键信息。
:::</p>
<p>:::warning
由于潜在风险，需要用户立即关注的关键内容。
:::</p>
<p>:::caution
某项操作可能带来的负面后果。
:::</p>
<h3>基本语法</h3>
<pre><code>:::note
提示用户应当留意的信息，即使只是略读也应注意到。
:::

:::tip
帮助用户更顺利完成的选填信息。
:::
</code></pre>
<h3>自定义标题</h3>
<p>admonitions的标题可以自定义。</p>
<p>:::note[MY CUSTOM TITLE]
这是一个带有自定义标题的 note。
:::</p>
<pre><code>:::note[MY CUSTOM TITLE]
这是一个带有自定义标题的 note。
:::
</code></pre>
<h3>GitHub 语法</h3>
<blockquote>
<p>[!TIP]
<a href="https://github.com/orgs/community/discussions/16925">GitHub 语法</a> 同样受支持。</p>
</blockquote>
<pre><code>&gt; [!NOTE]
&gt; GitHub 语法同样受支持。

&gt; [!TIP]
&gt; GitHub 语法同样受支持。
</code></pre>
<h3>剧透</h3>
<p>你可以给文字添加剧透。文字同样支持 <strong>Markdown</strong> 语法。</p>
<p>The content :spoiler[is hidden <strong>ayyy</strong>]!</p>
<pre><code>The content :spoiler[is hidden **ayyy**]!

</code></pre>
<h2>图片宽度与图注</h2>
<p>独立的图片在其 alt 文本中可接受一个可选的 <code>w-N%</code> 宽度标记，以及一个渲染为图片下方居中图注的 Markdown 标题：</p>
<p><img src="/images/albums/AcgExample/07.webp" alt="相册示例图片 w-50%" title="半宽且带图注的图片" /></p>
<pre><code>![图片描述 w-50%](./image.webp "可见图注")
</code></pre>
<p>有效宽度范围从 <code>w-1%</code> 到 <code>w-100%</code>；无效的标记会保留在 alt 文本中。宽度与图注相互独立——仅使用标题也会生成图注：</p>
<p><img src="/images/albums/AcgExample/08.webp" alt="相册示例图片 w-75%" /></p>
<p><img src="/images/albums/AcgExample/09.webp" alt="相册示例图片" title="不带宽度标记的图注" /></p>
]]></content>
    <author><name>XiaoMai</name></author>
    <category term="示例"/>
  </entry>
</feed>
