Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: xml comment whitespace handling #8607

Merged
merged 3 commits into from
Apr 9, 2023
Merged

fix: xml comment whitespace handling #8607

merged 3 commits into from
Apr 9, 2023

Conversation

yufeih
Copy link
Contributor

@yufeih yufeih commented Apr 8, 2023

Whitespace in C# documentation comment is significant when treated as markdown and inside <code> blocks.

Docfx trims code and top level xml comment using the following rules:

  1. Trim common leading whitespaces line by line:

         void main()
         {
             return
         }
    

    becomes

     void main()
     {
         return
     }
    
  2. Trim empty leading lines and trailing whitespace and new lines:

    
    
         void main()
     {
         return
     }
    
    

    becomes

         void main()
     {
         return
     }
    

Indents are added to <code> tags except for the first line, since the first new line in <pre><code> tag is new line significant:

<remarks>
    <code source="..." />
</remarks>

becomes

<remarks>
    <pre><code>void main()
    {
        return
    }</code></pre>
</remarks>

Fixes #4017
Fixes #2623
Fixes #6440
Fixes #2830
Fixes #2523

@yufeih yufeih added the bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note label Apr 8, 2023
@yufeih yufeih marked this pull request as ready for review April 8, 2023 13:30
@codecov
Copy link

codecov bot commented Apr 8, 2023

Codecov Report

Patch coverage: 85.50% and project coverage change: -0.08 ⚠️

Comparison is base (1125053) 74.68% compared to head (f4d9d0c) 74.61%.

❗ Current head f4d9d0c differs from pull request most recent head 8ee0a18. Consider uploading reports for the commit 8ee0a18 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8607      +/-   ##
==========================================
- Coverage   74.68%   74.61%   -0.08%     
==========================================
  Files         629      629              
  Lines       22837    22829       -8     
==========================================
- Hits        17056    17034      -22     
- Misses       5781     5795      +14     
Impacted Files Coverage Δ
....DocAsCode.Dotnet/Visitors/SymbolVisitorAdapter.cs 93.06% <43.75%> (-2.12%) ⬇️
...c/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs 85.66% <97.95%> (-1.18%) ⬇️
...ocAsCode.Dotnet/Parsers/XmlCommentParserContext.cs 100.00% <100.00%> (ø)
....DocAsCode.Dotnet/Parsers/XmlCommentTransformer.cs 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@yufeih yufeih closed this Apr 9, 2023
@yufeih yufeih reopened this Apr 9, 2023
@yufeih yufeih closed this Apr 9, 2023
@yufeih yufeih reopened this Apr 9, 2023
@yufeih yufeih merged commit 378feab into main Apr 9, 2023
@yufeih yufeih deleted the xmlcomment-ws branch April 9, 2023 08:29
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note
Projects
None yet
1 participant