Skip to main content

Markdown

The Markdown API enables you to render a markdown document as an HTML page or as raw text.

Render a Markdown document

post /markdown

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

textstringbody

Required. The Markdown text to render in HTML.

modestringbody

The rendering mode. Can be either markdown or gfm.

Default: markdown

contextstringbody

The repository context to use when creating references in gfm mode. For example, setting context to octo-org/octo-repo will change the text #42 into an HTML link to issue 42 in the octo-org/octo-repo repository.

Code samples

Example

Shell
curl \ -X POST \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/markdown
JavaScript @octokit/core.js
await octokit.request('POST /markdown', {})
GitHub CLI gh api
gh api \ --method POST \ -H "Accept: application/vnd.github.v3+json" \ /markdown

Response

Status: 200

Status codes

HTTP Status CodeDescription
200

OK

304

Not modified

Notes

Render a Markdown document in raw mode

You must send Markdown as plain text (using a Content-Type header of text/plain or text/x-markdown) to this endpoint, rather than using JSON format. In raw mode, GitHub Flavored Markdown is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.

post /markdown/raw

Status codes

HTTP Status CodeDescription
200

OK

304

Not modified

Notes