334.md 1.3 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# Markdown API

> 原文:[https://docs.gitlab.com/ee/api/markdown.html](https://docs.gitlab.com/ee/api/markdown.html)

*   [Render an arbitrary Markdown document](#render-an-arbitrary-markdown-document)

# Markdown API[](#markdown-api "Permalink")

在 GitLab 11.0 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18926) .

仅在 APIv4 中可用.

## Render an arbitrary Markdown document[](#render-an-arbitrary-markdown-document "Permalink")

```
POST /api/v4/markdown 
```

| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | yes | Markdown 文本呈现 |
| `gfm` | boolean | 否(可选) | 使用 GitLab 风味 Markdown 渲染文本. 默认为`false` |
| `project` | string | 否(可选) | 使用 GitLab Flavored Markdown 创建引用时,请使用`project`作为上下文. 如果项目不是公开的,则需要[认证](README.html#authentication) . |

```
curl --header Content-Type:application/json --data '{"text":"Hello world! :tada:", "gfm":true, "project":"group_example/project_example"}' "https://gitlab.example.com/api/v4/markdown" 
```

响应示例:

```
{  "html":  "<p dir=\"auto\">Hello world! <gl-emoji title=\"party popper\" data-name=\"tada\" data-unicode-version=\"6.0\">🎉</gl-emoji></p>"  } 
```