{{< details >}}

  1. Tier: 基础版, 专业版, 旗舰版
  2. Offering: JihuLab.com, 私有化部署

{{< /details >}}

将 Markdown 内容转换为 HTML。

仅在 APIv4 中可用。

必需的身份验证

{{< history >}}

  • 引入于极狐GitLab 15.3,使用名为 authenticate_markdown_api功能标志。默认启用。

{{< /history >}}

{{< alert type=”flag” >}}

此功能的可用性受控于功能标志。更多信息,可以查看历史。此功能仅为测试所用,并未生产就绪。

{{< /alert >}}

所有对 Markdown API 的 API 调用必须进行身份验证

渲染任意 Markdown 文档

POST /markdown
属性 类型 必需 描述
text string yes 要渲染的 Markdown 文本
gfm boolean no 使用极狐GitLab风格的 Markdown 渲染文本。默认值为 false
project string no 在使用极狐GitLab风格的 Markdown 创建引用时,使用 project 作为上下文
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
  --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>" }