Example Swagger/OpenAPI definition:
https://his-dev.mmprototype.net/api/v1/api-docs
swagger: '2.0'
paths: {}
basePath: '/'
info:
title: 'Health Insurance System API'
version: '1.0.0'
description: |
System for storing beneficiaries' health insurance information for the
Third-Party Liability group. Update active coverage or query the Carrier
Code Master File.
Newlines in the description fields are being converted to <br>. Since these fields should be treated as markdown, single newlines should be converted to an empty space. Double newlines would be converted to <p>.
For example:
System for storing beneficiaries' health insurance information for the\nThird-Party Liability group. is being converted to System for storing beneficiaries' health insurance information for the <br> Third-Party Liability group.
Steps to reproduce the behavior:
Linebreaks are converted to spaces. Contiguous lines are combined in a single <p>.

Hi @adborden! Thanks for filing an issue.
Below I've traced what's happening with the value in question.
description: |
System for storing beneficiaries' health insurance information for the
Third-Party Liability group. Update active coverage or query the Carrier
Code Master File.
js-yaml"System for storing beneficiaries' health insurance information for the\n
Third-Party Liability group. Update active coverage or query the Carrier\n
Code Master File.\n
"
remarkableBreaks are rendered as newlines (this is configured here), per https://github.com/swagger-api/swagger-ui/pull/3353.
<p>System for storing beneficiaries’ health insurance information for the<br>
Third-Party Liability group. Update active coverage or query the Carrier<br>
Code Master File.</p>
Since these fields should be treated as markdown, single newlines should be converted to an empty space. Double newlines would be converted to
<p>.
It doesn't appear that GitHub Flavored Markdown (which Swagger 2.0 calls for) behaves so*.
For example (since we _are_ on GitHub)....
This is a single new line,
and this is another.
As you can see, the lines are not being collapsed.
You can use a different YAML block style to get a different string that will feed into the Markdown renderer.
A folded-strip block style (instead of the literal-clip style you're currently using) should get you what you want:
description: >-
System for storing beneficiaries' health insurance information for the
Third-Party Liability group. Update active coverage or query the Carrier
Code Master File.
yields the following:
<p>System for storing beneficiaries’ health insurance information for the Third-Party Liability group. Update active coverage or query the Carrier Code Master File.</p>
Which is what I believe you were originally looking for.
Hope this helps! Let me know if you think anything above is in error.
*Notably, OpenAPI 3's CommonMark renderer _does_ put the same description value on one line.
By the way, https://stackoverflow.com/a/21699210 has a detailed reference of various YAML block styles and how they handle new lines.
The line-folding isn't the right solution, because in many cases, the new lines are important and should not be stripped out e.g.
description: >-
paragraph 1
is folded
paragraph 2
is folded
| Value | Description |
| ----- | ----------- |
| A | This is
| B | all folded.
| C | but shouldn't be.
becomes
paragraph 1 is folded
paragraph 2 is folded
| Value | Description | | ----- | ----------- | | A | This is | B | all folded. | C | but shouldn’t be.
and will not be rendered as an HTML table.
So I think | is the right folding, but you're saying the newline behavior is expected for OpenAPI 2?
BTW, Github Flavored Markdown is a bit funny, because in issues, the lines are folded but in documents like a README, the lines are not folded (you get the behavior that i'm looking for). I'm not sure if this is documented anywhere, but if you have a link to the markdown spec that swagger 2 is using, I would appreciate it.
Thanks for the details, @shockey Note that _multiple_ Markdown paragraphs (when using >- ) are rendered by Swagger UI with <br>; I think this is incorrect behavior (though not exactly what the OP cited when using | instead of >- ):
This is
paragraph 1.
This is paragraph 2.
is converted to
<p>This is paragraph 1. <br>This is paragraph 2.</p>
not as the expected
<p>This is paragraph 1.</p>
<p>This is paragraph 2.</p>
Changing this over to a bug 😄
We've opted into this behavior:
Per Remarkable's docs:
breaks: Convert '\n' in paragraphs into<br>.
Disabling this does get rid of the breaks seen in the test definition provided by @adborden.
Most helpful comment
Thanks for the details, @shockey Note that _multiple_ Markdown paragraphs (when using
>-) are rendered by Swagger UI with<br>; I think this is incorrect behavior (though not exactly what the OP cited when using|instead of>-):is converted to
not as the expected