Back to Gitlabhq

Markdown API

doc/api/markdown.md

18.11.21.7 KB
Original Source

{{< details >}}

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

{{< /details >}}

{{< history >}}

{{< /history >}}

Use this API to render Markdown content as HTML.

All requests to this API must be authenticated.

[!flag] The availability of this feature is controlled by a feature flag. For more information, see the history. This feature is available for testing, but not ready for production use.

Render Markdown content

Renders Markdown content as HTML.

plaintext
POST /markdown
AttributeTypeRequiredDescription
textstringyesThe Markdown text to render
gfmbooleannoRender text using GitLab Flavored Markdown. Default is false
projectstringnoUse project as a context when creating references using GitLab Flavored Markdown
shell
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"

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