richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.
MIT License
749 stars 150 forks source link

Add line breaks in notes #156

Closed fernandomm closed 7 years ago

fernandomm commented 7 years ago

Is it possible to add line breaks in notes? I tried two options:

notes "Line 1\nLine 2"
notes "Line 1<br />Line 2"

But none of them worked.

myeung58 commented 7 years ago

Your first method is working fine for me:

notes "Line 1 \n Line 2"

have you checked if the notes are successfully generated in the json doc?

fernandomm commented 7 years ago

Yes, the json is generated like this:

"notes": "Line 1 \n Line 2",

But at Swagger UI, the line breaks aren't displayed.

myeung58 commented 7 years ago

I'm unable to reproduce it. Tried both your methods and both are working.. Can you provide more details on how it's setup?

fernandomm commented 7 years ago

Could you share which version of Swagger UI you tested?

I'm using 2.2.6 and noticed that line breaks aren't enabled. So I had to add this:

marked.setOptions({breaks: true});

before loading Swagger UI.

After all this issue isn't related to this gem, so I will close it.