> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/creating-content/formatting/inline.md).

# 行内内容

<figure><img src="/files/fc1a344771a3d7328e23ce32860fc163a847b65f" alt="A GitBook screenshot showing inline content options"><figcaption><p>将行内元素添加到你的内容中。</p></figcaption></figure>

行内面板可让你快速为文本块添加额外内容，而无需把手离开键盘。只需按下 `/` 在任意文本块上即可打开行内面板。斜杠将被你选择插入的内容替换。

## 注释

通过注释，你可以在不打断读者思路的情况下，为你的文字添加额外上下文。你可以用它们来解释一个词的含义、插入额外信息等。读者将鼠标悬停在带注释的文本上时，注释会显示在文本上方。

### 创建注释

要创建注释，请选中你想要注释的文本，然后点击 **注释** 上下文菜单中的选项。写完注释后，点击其外部即可继续在文本块中输入。

### Markdown 表示法

你可以将内容写为 [Markdown 脚注](https://www.markdownguide.org/extended-syntax/#footnotes) ，以便在 GitBook 中将其添加为注释。脚注标记应紧跟在你想要注释的词后面；它们不应出现在标点符号或其他符号之后。

```markdown
这里有一个简单的脚注[^1]，以及一个更长的脚注[^bignote]。

[^1]: 这是第一个脚注。

[^bignote]: 这里有一个包含多个段落和代码的脚注。

    将段落缩进，以将它们包含在脚注中。

    `{ my code }`

    你可以添加任意多个段落。
```

## 图片

行内图片会与你的文本一起显示在页面上。

默认情况下，图片会按其原始尺寸显示，最大宽度为 300px。你可以点击图片打开格式面板，然后选择以下三个选项之一来更改大小：

1. **行内大小：** 图片会按字体比例缩放——非常适合图标和徽章。
2. **原始大小：** 图片将保持行内显示，并以其原始大小呈现，最大宽度为 300 像素。
3. **转换为块：** 这会将行内图片转换为图片块，其宽度与内容相同。

{% hint style="info" %}
图片块提供更多选项，包括更多尺寸以及添加说明文字的能力——但不会与文本行内显示。
{% endhint %}

### Markdown 中的表示

{% code overflow="wrap" %}

```markdown
这里是一张行内图片：<img src=".gitbook/assets/GitBook - Dark.jpg" alt="GitBook 深色版本标志" data-size="line">
```

{% endcode %}

## 表情符号

你可以按下 `/` 来打开行内面板。或者，输入 `:` ，表情符号列表会直接在行内弹出——你可以开始输入表情符号的名称来缩小选择范围。

### Markdown 中的表示

{% code overflow="wrap" %}

```markdown
:house:
:car:
:dog:
```

{% endcode %}

## 链接

你可以插入三种不同类型的链接：

* [相对链接](#relative-links)
* [绝对链接](#absolute-links)
* [电子邮件地址 `mailto` 链接](#email-address-mailto-links)

### 相对链接

相对链接是通过链接到你所在部分中已存在的页面创建的链接。使用相对链接的好处是，如果页面的 URL、名称或位置发生变化，其引用会保持最新——因此你最终会遇到更少的失效链接。

以下是插入相对链接的方法：

1. 点击段落中你想插入链接的位置，或选中一些文本。
2. 按 / 打开行内面板并选择“链接”，点击 **链接** 上下文菜单中的按钮，或按下 **⌘ + K**.
3. 开始输入你想链接到的页面标题。
4. 从下拉搜索结果中选择该页面。
5. 按 `Enter`.

### 绝对链接

绝对链接是可以复制并粘贴到内容中的外部链接。当你想链接到文档之外的内容时，它们非常有用。

要插入绝对链接：

1. 点击段落中你想插入链接的位置，或选中一些文本。
2. 按 / 打开行内面板并选择“链接”，点击 **链接** 上下文菜单中的按钮，或按下 **⌘ + K**.
3. 粘贴你想链接到的 URL。
4. 按 `Enter`.

{% hint style="info" %}
**为什么外部链接不会在新标签页中打开？**

当你在文档中添加一个外部网站链接时，它会在同一个标签页中打开。

GitBook 遵循此 [W3C 推荐的行为](https://www.w3.org/TR/WCAG20-TECHS/G200.html) 以支持 [可访问性](https://it.wisc.edu/learn/make-it-accessible/websites-and-web-applications/when-to-open-links-in-a-new-tab/) 并为你的读者确保一致、包容的体验。
{% endhint %}

### 电子邮件地址 mailto 链接

电子邮件地址 `mailto` 链接在你希望访客点击后打开其默认邮件客户端并填写 `收件人` 字段中的链接电子邮件地址时非常有用，这样他们就可以撰写并发送邮件。

以下是插入电子邮件地址 `mailto` 链接的方法：

1. 点击段落中你想插入链接的位置，或选中一些文本。
2. 按 / 打开行内面板并选择“链接”，点击 **链接** 上下文菜单中的按钮，或按下 **⌘ + K**.
3. 粘贴或输入 `mailto:something@address.com`，并将 `something@address.com` 替换为你想使用的电子邮件地址。
4. 按 `Enter`.

### Markdown 中的表示

```markdown
[这是指向本部分中另一页面的相对链接](../content-structure/page.md)
[这是一个绝对链接](https://www.gitbook.com/blog)
[这是一个链接](mailto:support@gitbook.com) 到我们的支持邮箱地址
```

## 数学与 TeX

使用此选项，你可以在内容中创建行内数学公式，例如： $$f(x) = x \* e^{2 pi i \xi x}$$。我们使用 [KaTeX](https://katex.org/docs/supported.html) 库来渲染公式。

{% hint style="info" %}
你也可以在空白块中打开命令面板，并选择第二个“数学与 TeX”选项，来插入块级数学公式。
{% endhint %}

### Markdown 中的表示

```markdown
# 数学与 TeX 块

$$f(x) = x * e^{2 pi i \xi x}$$
```

## 按钮

按钮是突出显示行动号召，或在文档中添加搜索栏或 Ask AI 栏的好方法。你可以用它们把读者带到某个地方，或帮助他们找到答案。

### 按钮操作

按钮不仅可以链接到 URL。你还可以直接在页面上将按钮变为搜索栏或 GitBook Assistant 提问栏。这些操作在已发布页面上也同样有效——如下方示例所示。

你可以配置以下操作：

#### **添加链接按钮**

将读者发送到另一个页面或外部 URL：<a href="/pages/9f97be21402fc075995178c6e13cb838c64a90aa" class="button primary" data-icon="gitbook-assistant">了解更多关于 Assistant 的信息</a>

#### **添加搜索栏**

打开搜索，并可选预设查询： <button type="button" class="button primary" data-action="search" data-icon="magnifying-glass">搜索...</button>

#### **添加 Ask AI/GitBook Assistant 栏**

打开 GitBook Assistant，并可选预设提示： <button type="button" class="button primary" data-action="ask" data-icon="gitbook-assistant">提出一个问题...</button>

#### **添加禁用按钮**

显示一个有意处于非活动状态的按钮：<a class="button primary">非活动按钮</a>

### 创建并配置按钮

1. 类型 `/` 并选择 **按钮**.
2. 点击该按钮以打开 **标签** 菜单。
3. 选择一个操作，然后设置标签和样式。
4. 可选：添加预设搜索查询或 Assistant 提示。

### 样式

链接按钮和非活动按钮都有主要和次要样式。以下是几个示例：

<a href="https://app.gitbook.com/join" class="button primary">注册 GitBook</a> <a href="#annotations" class="button secondary">回到顶部</a>

### Markdown 中的表示

```markdown
<a href="https://app.gitbook.com" class="button primary">GitBook</a>
```

## 图标

图标可让你为网站添加额外的视觉提示。你可以将它们行内添加到段落中、卡片内，或任何需要增添亮点的地方。它们将使用你在自定义设置中定义的视觉样式。

<i class="fa-facebook">:facebook:</i> <i class="fa-github">:github:</i> <i class="fa-x-twitter">:x-twitter:</i> <i class="fa-instagram">:instagram:</i>

访问 [Font Awesome](https://fontawesome.com/) 以浏览可用的不同图标。

### Markdown 中的表示

```markdown
<i class="fa-github">:github:</i>
```

## 表达式

表达式允许你动态显示变量中定义的内容。表达式可以从 `/` 菜单中插入。插入后，点击表达式将打开表达式编辑器，使你能够引用并 [有条件地格式化](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator) 你的变量。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/creating-content/formatting/inline.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
