# /api/v3/render/markdown
---
post:
  parameters:
  - description: |-
      API-Link to the context in which the rendering occurs, for example a specific work package.

      If left out only context-agnostic rendering takes place.
      Please note that OpenProject features markdown-extensions on top of the extensions GitHub Flavored Markdown (gfm) already
      provides that can only work given a context (e.g. display attached images).

      **Supported contexts:**

      * `/api/v3/work_packages/{id}` - an existing work package
    example: "/api/v3/work_packages/42"
    in: query
    name: context
    required: false
    schema:
      type: string
  responses:
    '200':
      content:
        text/html:
          examples:
            response:
              value: '<p>Hello world! <a href="http://example.com">This</a> <strong>is</strong> markdown!</p>'
          schema:
            "$ref": "../components/schemas/markdown_model.yml"
      description: OK
      headers: {}
    '400':
      content:
        application/hal+json:
          schema:
            $ref: "../components/schemas/error_response.yml"
          examples:
            response:
              value:
                _type: Error
                errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRenderContext
                message: Could not render markdown string in the given context.
      description: |-
        Returned if the context passed by the client is not valid (e.g. unknown).

        Note that this response will also occur when the requesting user
        is not allowed to see the context resource (e.g. limited work package visibility).
      headers: {}
    '415':
      content:
        application/hal+json:
          schema:
            $ref: "../components/schemas/error_response.yml"
          examples:
            response:
              value:
                _type: Error
                errorIdentifier: urn:openproject-org:api:v3:errors:TypeNotSupported
                message: Expected Content-Type to be 'text/plain' but got 'application/json'.
      description: Returned if the Content-Type indicated in the request is not `text/plain`.
      headers: {}
  tags:
  - Previewing
  description: ''
  operationId: Preview_Markdown_document
  summary: Preview Markdown document
