debian-mirror-gitlab/doc/api/markdown.md

35 lines
1.4 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
2020-10-24 23:57:45 +05:30
stage: Create
group: Source Code
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers"
type: reference, api
2020-06-23 00:09:42 +05:30
---
2018-11-08 19:23:39 +05:30
# Markdown API
2020-04-22 19:07:51 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18926) in GitLab 11.0.
2018-11-08 19:23:39 +05:30
Available only in APIv4.
## Render an arbitrary Markdown document
2020-04-08 14:13:33 +05:30
```plaintext
2018-11-08 19:23:39 +05:30
POST /api/v4/markdown
```
| Attribute | Type | Required | Description |
| --------- | ------- | ------------- | ------------------------------------------ |
2020-01-01 13:55:28 +05:30
| `text` | string | yes | The Markdown text to render |
2020-11-24 15:15:51 +05:30
| `gfm` | boolean | no | Render text using GitLab Flavored Markdown. Default is `false` |
| `project` | string | no | Use `project` as a context when creating references using GitLab Flavored Markdown. [Authentication](README.md#authentication) is required if a project is not public. |
2018-11-08 19:23:39 +05:30
2020-03-13 15:44:24 +05:30
```shell
2020-06-23 00:09:42 +05:30
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"
2018-11-08 19:23:39 +05:30
```
Response example:
```json
{ "html": "<p dir=\"auto\">Hello world! <gl-emoji title=\"party popper\" data-name=\"tada\" data-unicode-version=\"6.0\">🎉</gl-emoji></p>" }
```