GitHub Markdown API

The GitHub Markdown API is a REST service that converts Markdownespecially GitHub Flavored Markdowninto the same HTML GitHub renders in READMEs, issues, and pull requests, so external apps can display content consistently with GitHub.

OpenAPI Specification

github-markdown-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Github Markdown API
  version: 1.1.4
  contact:
    name: Support
    url: https://support.github.com/contact?tags=dotcom-rest-api
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  termsOfService: https://docs.github.com/articles/github-terms-of-service
  description: 'Operations tagged Markdown across 2 of this provider''s published API definitions: github-markdown-openapi.yml, github-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: '{protocol}://{hostname}/api/v3'
  variables:
    hostname:
      description: Self-hosted Enterprise Server hostname
      default: HOSTNAME
    protocol:
      description: Self-hosted Enterprise Server protocol
      default: http
tags:
- name: Markdown
paths:
  /markdown:
    post:
      summary: GitHub Render Markdown Document
      description: This API operation accepts a POST request to the /markdown endpoint and is used to render Markdown-formatted text into its processed output, typically HTML. When you send a Markdown document to this endpoint, it parses the Markdown syntax and returns the rendered result, allowing applications to convert user-written Markdown content into display-ready formatted text without implementing their own Markdown parser.
      operationId: renderMarkdownDocument
      tags:
      - Markdown
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/markdown/markdown#render-a-markdown-document
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                text:
                  description: The Markdown text to render in HTML.
                  type: string
                mode:
                  description: The rendering mode.
                  enum:
                  - markdown
                  - gfm
                  default: markdown
                  example: markdown
                  type: string
                context:
                  description: 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.
                  type: string
              required:
              - text
              type: object
            examples:
              default:
                summary: Rendering markdown
                value:
                  text: Hello **world**
      responses:
        '200':
          description: Response
          headers:
            Content-Type:
              $ref: '#/components/headers/content-type'
            Content-Length:
              example: '279'
              schema:
                type: string
            X-CommonMarker-Version:
              $ref: '#/components/headers/x-common-marker-version'
          content:
            text/html:
              schema:
                type: string
              examples:
                default:
                  summary: Example response
                  value: <p>Hello <strong>world</strong></p>
        '304':
          $ref: '#/components/responses/not_modified'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: markdown
        subcategory: markdown
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    servers:
    - url: '{protocol}://{hostname}/api/v3'
      variables:
        hostname:
          description: Self-hosted Enterprise Server hostname
          default: HOSTNAME
        protocol:
          description: Self-hosted Enterprise Server protocol
          default: http
  /markdown/raw:
    post:
      summary: GitHub Render Markdown Document in Raw Mode
      description: 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](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less.
      operationId: renderMarkdownDocumentInRawMode
      tags:
      - Markdown
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/enterprise-server@3.9/rest/markdown/markdown#render-a-markdown-document-in-raw-mode
      parameters: []
      requestBody:
        required: false
        content:
          text/plain:
            schema:
              type: string
            examples:
              default:
                value:
                  text: Hello **world**
          text/x-markdown:
            schema:
              type: string
            examples:
              default:
                summary: Rendering markdown
                value:
                  text: Hello **world**
      responses:
        '200':
          description: Response
          headers:
            X-CommonMarker-Version:
              $ref: '#/components/headers/x-common-marker-version'
          content:
            text/html:
              schema:
                type: string
              examples:
                default:
                  summary: Example response
                  value: <p>Hello <strong>world</strong></p>
        '304':
          $ref: '#/components/responses/not_modified'
      x-github:
        githubCloudOnly: false
        enabledForGitHubApps: true
        category: markdown
        subcategory: markdown
      security:
      - bearerHttpAuthentication: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    servers:
    - url: '{protocol}://{hostname}/api/v3'
      variables:
        hostname:
          description: Self-hosted Enterprise Server hostname
          default: HOSTNAME
        protocol:
          description: Self-hosted Enterprise Server protocol
          default: http
components:
  headers:
    content-type:
      example: text/html
      schema:
        type: string
    x-common-marker-version:
      example: 0.17.4
      schema:
        type: string
  responses:
    not_modified:
      description: Not modified
  securitySchemes:
    bearerHttpAuthentication:
      description: Bearer Token
      type: http
      scheme: Bearer
externalDocs:
  description: GitHub Enterprise Developer Docs
  url: https://docs.github.com/enterprise-server@3.9/rest/
x-refined-from:
- github-markdown-openapi.yml
- github-openapi.yml