3

I'm trying to include an image in the description field of the info section of my swagger, which is displayed with Swagger-UI. So far I've tried GFM:

...
  "info": {
    "description": "![alt text][/static/img/image.png]"
  }
...

and plain old HTML:

...
  "info": {
    "description": "<img alt=\"alt text\" src=\"/static/img/image.png\">"
  }
...

But both of these just render the string as given and don't display the image.

Is there a way to do this?

Helen
  • 87,344
  • 17
  • 243
  • 314
Tom
  • 7,269
  • 1
  • 42
  • 69
  • Depending on your toolset you can try the CSS approach from here: https://stackoverflow.com/a/62817980/8607180 – Sasha Nov 17 '21 at 18:21

1 Answers1

4

In your first example, replace

![alt text][/static/img/image.png]

with

![alt text](/static/img/image.png)

Note the image path is denoted with parentheses () instead of square brackets [].

See also How to format descriptions with Markdown in OpenAPI / Swagger UI.

Helen
  • 87,344
  • 17
  • 243
  • 314