> 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/chuang-jian-nei-rong/formatting/inline.md).

# 行内内容

使用行内面板添加图片、链接、数学与 TeX 等内容

<figure><img src="https://2111890564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-ff408ea9fda9c18aa7bcaf84c90bfe14040c9c87%2F26_01_22_inline-palette%402x.png?alt=media" 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]: 这是一个包含多个段落和代码的脚注。

    缩进段落以将其包含在脚注中。

    `{ 我的代码 }`

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

### 渲染示例

Markdown 源文本会在所引用的文本上创建一个注释：

```markdown
注释添加额外上下文[^annotation-example]。

[^annotation-example]: 将鼠标悬停在“额外上下文”上即可阅读此注释。
```

渲染如下。将鼠标悬停在带注释的文本上可预览注释：

注释添加额外上下文。[^1]

## 图片

行内图片将与页面上的文本并排显示。

默认情况下，图片会以原始尺寸显示，最大宽度为 300 像素。你可以点击图片打开格式调色板，然后选择以下三个选项之一：

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 %}

渲染如下：这里有一张行内图片： <img src="https://2111890564-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNkEGS7hzeqa35sMXQZ4X%2Fuploads%2Fgit-blob-ff408ea9fda9c18aa7bcaf84c90bfe14040c9c87%2F26_01_22_inline-palette%402x.png?alt=media" alt="GitBook logo" data-size="line">

## 表情符号

按 `/` 即可添加表情符号并打开行内调色板。或者，输入 `:` ，表情符号列表便会直接显示在行内 — 你可以开始输入表情符号名称来缩小选择范围。

### Markdown 表示

{% code overflow="wrap" %}

```markdown
:house:
:smile:
:dog:
```

{% endcode %}

它们的渲染效果如下： :house: :smile: :dog:

## 链接

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

* [相对链接](#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` 链接适用于这样的场景：访客点击链接后，会打开默认的电子邮件客户端，并在 `To` 字段中填入链接中的电子邮件地址，方便他们撰写并发送邮件。

插入电子邮件地址 `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)
```

它们的渲染效果如下：

[这是指向本节中另一页面的相对链接](https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/content-structure.md)\
[这是一个绝对链接](https://www.gitbook.com/blog)\
[这是一个链接](mailto:support@gitbook.com) 指向我们的支持邮箱

## 数学与 TeX

使用此选项，你可以在内容中创建行内数学公式。我们使用 [KaTeX](https://katex.org/docs/supported.html) 用于渲染公式的库。

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

### Markdown 表示

```markdown
这是一个行内公式：$$f(x) = x * e^{2 pi i \\xi x}$$
```

渲染如下：这是一个行内公式： $$f(x) = x \* e^{2 pi i \xi x}$$

## 按钮

按钮是突出行动号召，或为你的文档添加搜索栏或 Ask AI 栏的绝佳方式。你可以用它们将读者引导到某个地方，或帮助他们找到答案。

### 按钮操作

按钮的用途不只是链接到 URL。你还可以将按钮变成搜索栏或 AI 助手输入栏——就在页面上直接实现。这些操作在已发布的页面上也同样有效——从下面的示例中你就能看到。

你可以配置以下操作：

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

将读者发送到其他页面或外部 URL：<a href="https://gitbook.com/docs/documentation/zh/ai-for-your-readers/gitbook-ai-assistant.md" 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 栏**

使用可选的预设提示打开 AI 助手： <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>
```

渲染如下： <a href="https://app.gitbook.com" class="button primary">GitBook</a>

## 图标

图标可为段落、卡片和其他内容添加视觉上下文。它们使用你自定义设置中定义的视觉样式。

使用一个 `<i>` 元素，并同时使用图标名称的两种形式。Font Awesome 类名和标记必须匹配：

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

从 [Font Awesome 图标选择器](https://fontawesome.com/search)中选择图标名称。不受支持的名称可能无法渲染，也可能无法通过 Git Sync 保留。

<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>

### Markdown 表示

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

渲染如下： <i class="fa-github">:github:</i>

## 表达式

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

### Markdown 表示

```markdown
欢迎使用 <code class="expression">page.vars.inlineExampleProduct</code>。
```

渲染效果如下：欢迎来到 <code class="expression">page.vars.inlineExampleProduct</code>.

[^1]: 这是一个注释。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/formatting/inline.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
