Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

[Bug]: Multi-line paragraphs render as pre code html tag pair

Open rcollette opened this issue 6 months ago • 0 comments

Describe the bug

Given XML comments like

    /// <remarks>
    ///     <para>
    ///         If the user already exists, returns an HTTP 409 and the existing user profile. If the
    ///         user cannot be created due the email domain being on the block list, an HTTP 406 is returned.  If the user
    ///         cannot be created because the email domain cannot be legally processed (ex. OFAC compliance), then an HTTP 451
    ///         code is returned
    ///     </para>
    ///     <para>
    ///         If the user is in the STAGED or PROVISIONED state, and the user's mail domain is NOT federated to an external
    ///         identity provider (ex. by SAML), the Activation property along with its contained ActivationUrl property will
    ///         be set.  The ActivationUrl may be included as a link in a "Welcome" email to the user.  When the user navigates
    ///         to that URL, they will be asked to set their password.
    ///         **The client application should append a fromURI query string parameter (case-sensitive)**,
    ///         which will cause the user to be redirected to an appropriate page, after setting their
    ///         password.
    ///     </para>
    ///     <para>
    ///         Users associated with federated identity providers do not need to be activated or sent an activation link. The
    ///         user will be activated automatically once authenticated by their identity provider.  The user may be sent an
    ///         email with a URL link that sends them directly to the application.
    ///     </para>
    ///     <para>security group: identity_user_create</para>

When the paragraph is multiple lines and the <para> tag stands on its own line. The paragraph is being rendered as a <pre><code> HTML pair, which I believe is incorrect, since there is a <code> tag for XML comments that should equate to HTML <pre><code> (or perhaps just code).

Aside from the glaring difference in formatting between the paragraphs, markdown such a bold (two stars) does not get rendered in the <pre><code> sections, as shown in this screenshot.

image

Expected behavior

New lines within a <para> tag should not be included in the generated JSON and <para> tags should be represented as \n\r in the generated json. This would provide the expected rendering.

Actual behavior

<para> tags in XML comments are rendering as HTML <pre><code> pairs when the paragraph extends over more than one line.

Steps to reproduce

No response

Exception(s) (if any)

No response

Swashbuckle.AspNetCore version

6.7.0

.NET Version

net8.0

Anything else?

No response

rcollette avatar Aug 06 '24 23:08 rcollette