Skip to content

[Bug]: Put <details> into remarks with <code>, the display of content is looks strange #3069

@Flithor

Description

@Flithor

Describe the bug

the example api documentation

/// <summary>My work api</summary>
/// <remarks>
/// <details>
/// <summary>Details Title</summary>
/// <code>
/// {
///  "Prop1":1,
///  "Prop2":[]
/// }
/// </code>
/// </details>
/// </remarks>

And I got this:
image
ther part in json is this:

"description": "<details>\r\n  <summary>Details Title</summary>\r\n  ```\r\n            {\r\n             \"Prop1\":1,\r\n             \"Prop2\":[]\r\n            }\r\n            ```\r\n</details>"

Test OpenApi on swagger-ui test see here: swagger-api/swagger-ui#4977 (comment)

The workaround:

Put some text before <details>, and add <br/> before and after <code>...</code>

/// <summary>My work api</summary>
/// <remarks>
/// You need put some text before "details" tag can reomve the long space string in output
/// <details>
/// <summary>Details Title</summary><br/>
/// <code>
/// {
///  "Prop1":1,
///  "Prop2":[]
/// }
/// </code><br/>
/// </details>
/// </remarks>

And looks fine:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions