你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

文档分析:Markdown 声明

Foundry 工具中的 Azure 内容理解将非结构化文档转换为 GitHub 风格 Markdown,在保留内容和布局的同时,确保下游的准确使用。 本文介绍如何在 Markdown 中表示每个内容和布局元素。

字词和选择标记

识别的字词和检测到的选择标记以 Markdown 表示为纯文本。 选择标记使用 Unicode 字符 ☒ (已选中)和 ☐ (已清除)进行编码。 内容可能会被转义,以避免与 Markdown 格式化语法产生歧义。

条形码

条形码表示为具有替代文本和标题的 Markdown 图像:![alt text](url "title")。

内容类型 Markdown 模式 示例:
条形码 ![{barcode.kind}]({barcode.path} "{barcode.value}") ![QRCode](barcodes/1.2 "https://www.microsoft.com")

公式

在 Markdown 中使用 LaTeX 对数学公式进行编码:

  • 内联公式用单美元符号($...$)括起来,以保持文本流。
  • 展示型公式使用双美元符号 ($$...$$) 进行独立显示。
  • 多行公式表示为连续显示公式,中间没有空行。 此结构保留数学关系。
公式类型 Markdown 可视化
内联 $\sqrt { -1 } $ is $i$ $\sqrt { -1 } $ 为 $i$
显示位置 $$a^2 + b^2 = c^2$$ $a^2 + b^2 = c^2$
多行 $$( x + 2 ) ^ 2 = x ^ 2 + 4 x + 4$$
$$= x ( x + 4 ) + 4$$
$$(x + 2) ^ 2 = x ^ 2 + 4 x + 4$$ $$= x (x + 4) + 4$$

映像

检测到的图像(包括图形和图表)用标准 Markdown 图像语法表示。 替换文字包含图中检测到的文本,语法因配置选项而异。

图像表示模式

配置 Markdown 模式 Description
基本 ![detected text](figures/path) 没有说明的标准映像
启用图形描述 ![detected text](figures/path "description") 包括生成的图像描述
启用图形描述 (enableFigureDescription) + 启用图形分析 (enableFigureAnalysis) ![detected text](figures/path "description") 后跟图表、Markdown 表格或 Mermaid 图表 具有说明和附加的图形分析的图像(图解、表或图表)
仅限 enableFigureAnalysis ![detected text](figures/path) 后跟图表、Markdown 表格或 Mermaid 图表 没有描述的图像和附加的图形分析(图表、表格或示意图)

当图未检测到文本时,服务会插入一个空格作为替换文字,以便图像正确呈现,例如 ![ ](figures/1.1)。

例子

没有启用 enableFigureDescription 的图像

![Line1 Line2](figures/1.1)

启用图像描述功能的图像

![Line1 Line2](figures/1.1 "This is a generated image description.")

具有 enableFigureDescription 和 enableFigureAnalysis 的图像

![Line1 Line2](figures/1.1 "This is a generated image description.")
选项 1:图表分析
{ ...chart config... }
选项 2:Markdown 表格图形分析
| Month | Value |
|-------|-------|
| Jan   | 100   |
| Feb   | 150   |
| Mar   | 200   |
| Apr   | 250   |
| May   | 300   |
| Jun   | 275   |

未启用 enableFigureDescription 和 enableFigureAnalysis 的图像

![Line1 Line2](figures/1.1)

```mermaid
{ ...mermaid diagram... }

图分析

在文档中检测到的图表被表示为具有专用呈现格式的结构化图形内容。

图表

图表以 JSON 格式的 Chart.js 语法在图内容中表示。 根据 config.chartFormat 设置(chartJs 或 markdown),图表可以表示为 Chart.js 代码块或 Markdown 表。

Chart.js 格式(chartFormat=chartJs)

{
  "type": "bar",
  "data": {
    "labels": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    "datasets": [{
      "label": "Values",
      "data": [100, 150, 200, 250, 300, 275],
      "backgroundColor": "rgba(54, 162, 235, 0.2)",
      "borderColor": "rgba(54, 162, 235, 1)",
      "borderWidth": 1
    }]
  },
  "options": {
    "scales": {
      "y": {
        "beginAtZero": true
      }
    }
  }
}

Markdown 表格式(chartFormat=markdown)

月份 价值观
1 月 100
2 月 150
三月 200
四月 250
5 月 300
六月 275

图表

图表在图形内容中使用 Mermaid 语法表示,并在 Markdown 中以 Mermaid 代码块的形式渲染。

graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E

渲染支持

常用的 Markdown 扩展和查看器支持 Chart.js 和美人鱼代码块的视觉呈现:

  • Chart.js:呈现交互式图表和图形
  • 美人鱼:呈现流程图、序列图和其他图表类型
  • 大多数新式 Markdown 处理器都包括这两种格式的插件

签名

检测到的签名表示为 Markdown 图像,类似于数字。 替换文字包含签名区域中识别的任何文本。

注释

签名检测仅在 2026-06-01-preview API 版本中可用。

由于签名在样式、方向和易读性方面差异很大,因此签名区域中识别的文本的准确性可能会有所不同,并且可能低于标准打印文本。 将识别的文本视为补充信号,而不是权威听录。

内容类型 Markdown 模式 示例:
Signature ![{recognized text}](signatures/{path}) ![Mary Hell](signatures/1.1)

当签名没有识别的文本时,服务会插入一个空格作为替换文字,以便图像正确呈现:

![ ](signatures/1.1)

当签名与页面区域(如页脚)关联时,该签名将编码为 HTML 注释以及该区域:

<!-- PageFooter="![Mary Hell](signatures/1.1)" -->

行和段落

段落在 Markdown 中表示为用空白行分隔的文本块。 当行可用时,文档中的每一行都映射到 Markdown 中的单独一行。

章节

具有标题或节标题角色的段落将转换为 Markdown 标题。 如果有标题,则将其指定为一级标题。 将分配所有其他部分的标题级别以保留检测到的分层结构。

表格

当前,通过使用 HTML 表格标记(<table>、<tr>、<th> 和 <td>)来在 Markdown 中表示表格,从而支持通过 rowspan 和 colspan 属性实现合并单元格,并通过 <th> 实现丰富的表头。 任何标题都通过 <caption> 元素表示。 任何关联的脚注在表格后面立即显示为文本。

<table>
<caption>Table 1. Example</caption>
<tr><th>Header A</th><th>Header B</th></tr>
<tr><td>Cell 1A</td><td>Cell 1B</td></tr>
<tr><td>Cell 2A</td><td>Cell 2B</td></tr>
</table>
This is a footnote.
表 1. 示例:
标头 A标头 B
单元格 1A单元格 1B
单元格 2A单元格 2B
这是一个脚注。

页面元数据

Markdown 无法原生编码页面元数据,例如页码、页眉、页脚和分页符。 由于此信息可能对下游应用程序有用,因此我们对 HTML 注释等元数据进行编码。

元数据 Markdown
页码 <!-- PageNumber="1" -->
页眉 <!-- PageHeader="Header" -->
页脚 <!-- PageFooter="Footer" -->
分页 <!-- PageBreak -->

检测到的数字内容的超链接使用标准 Markdown 链接语法表示。 该服务保留原始文档中的显示文本和目标 URL。

链接类型 Markdown 模式 示例:
标准链接 [display text](url) [Visit Microsoft](https://www.microsoft.com)

例子

For more information, visit the [Microsoft Foundry](https://aka.ms/ai-foundry) portal.

Contact our support team at [support@contoso.com](mailto:support@contoso.com "Email support").

See the [official documentation][docs] for detailed instructions.

[docs]: https://learn.microsoft.com

Annotations

文档注释(如突出显示、下划线和注释)可以使用参数控制 annotationFormat 的不同格式在 Markdown 中表示。

批注格式

Format Description 用例
none Markdown 中没有批注信息 完全控制批注表示形式
frontMatter 使用 HTML 跨度在 YAML 前置元数据中添加注释 具有完整文档上下文的简单 RAG 场景
markdown 原生 Markdown 注释语法 标准 Markdown 兼容性

格式:无

设置 annotationFormat=none时,Markdown 不包含批注信息。 将enableAnnotation和returnDetails都设置为true以提取批注。

This is the document content without any annotation markers.
Use the annotations JSON property to customize representation.

格式:frontMatter(默认值)

使用 HTML 片段对 YAML 前置内容中的批注进行编码,其中的id属性用来引用批注详细信息。

---
fields:
  title: "Document Title"
annotations:
- id: underline-1
  author: Paul
  type: underline
  comments:
  - message: "Please review this section"
    author: Paul
    tags: "approved,👍3"
- id: highlight-2
  author: Sarah
  type: highlight
  comments:
  - message: "Important information"
    author: Sarah
---

This is <span id="underline-1">underlined text</span> in the document.

This section contains <span id="highlight-2">highlighted content</span> for emphasis.

<!-- Annotations without spans appear at page end -->
<span id="note-3" />

格式:markdown

当目标 Markdown 处理器支持时,使用本机 Markdown 语法进行批注。

This text has ==highlighted content== for emphasis.

This text has ++underlined content++ for attention.

> **Note:** This is an annotation comment.

结论

内容理解 Markdown 元素提供了一种强大的方法来表示已分析文档的结构和内容。 正确理解和使用这些 Markdown 元素时,可以增强文档处理工作流。 还可以生成更复杂的内容提取应用程序。