Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.54 KB

File metadata and controls

52 lines (34 loc) · 1.54 KB
title Markdown Rendering | GitHub API

Markdown Rendering API

  • TOC {:toc}

Render an arbitrary Markdown document

POST /markdown

Input

text : Required string - The Markdown text to render

mode : Optional string - The rendering mode

- `markdown` to render a document as plain Markdown, just like README files are rendered.
- `gfm` to render a document as user-content, e.g. like user comments or issues are rendered. In GFM mode, hard line breaks are always taken into account, and issue and user mentions are linked accordingly.

context : Optional string - The repository context, only taken into account when rendering as gfm

<%= json
:text => "Hello world github-linguist/linguist#1 cool, and #1!", :mode => "gfm", :context => "github/gollum" %>

Response

<%= text_html
%(

Hello world github/linguist#1 cool, and #1!

), 200 %>

Render a Markdown document in raw mode

POST /markdown/raw

Input

The raw API is not JSON-based. It takes a Markdown document as plaintext (text/plain or text/x-markdown) and renders it as plain Markdown without a repository context (just like a README.md file is rendered -- this is the simplest way to preview a readme online).

Response

<%= text_html
%(

Hello world github-linguist/linguist#1 cool, and #1!

), 200 %>