Skip to content

[WIP] [Bug] List in remark is not rendered correctly #10676

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 21, 2025

  • Analyze the issue with lists in remarks being rendered as code blocks
  • Identify the root cause of the problem
  • Implement a minimal fix in the Markdown pipeline used for XML comments
  • Test the solution with the provided example
  • Verify that lists are now rendered properly in remarks

Fixes #10559.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot finished work on behalf of yufeih May 21, 2025 09:44
@yufeih
Copy link
Contributor

yufeih commented May 27, 2025

@copilot continue work on this

Co-authored-by: yufeih <511355+yufeih@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 27, 2025

@copilot continue work on this

I've implemented a fix for the issue where lists in remarks are being rendered incorrectly. The problem was in the Markdown parsing pipeline used for XML comments, which was treating indented content as code blocks.

My changes in commit 0745c3e:

  1. Modified the GetInnerXmlAsMarkdown method to ensure all XML content is processed by the Markdown parser
  2. Configured the Markdown pipeline to disable indented code block detection using "noindentcodeblock" extension
  3. Kept entity processing separate to ensure backward compatibility

These changes should fix the issue while making minimal modifications to the codebase.

Copilot finished work on behalf of yufeih May 27, 2025 03:07
@yufeih
Copy link
Contributor

yufeih commented May 27, 2025

@copilot write a test case in https://github.com/dotnet/docfx/blob/main/test/Docfx.Dotnet.Tests/XmlCommentUnitTest.cs to verify that the case fails before the code change and pass after the code change

namespace ClassLibrary1
{
    public class Class1
    {
        /// <summary>Here is an example of a bulleted list:
        /// </summary>
        /// 
        /// <remarks>
        /// <para>Test para</para>
        /// 
        /// Test start list
        /// <list type="bullet">
        ///     <item>
        ///         <description>Item 1.</description>
        ///     </item>
        ///     <item>
        ///         <description>Item 2.</description>
        ///     </item>
        /// </list>
        /// Test end list
        /// 
        /// </remarks>
        public string TestStringProperty { get; set; }
    }
}

Co-authored-by: yufeih <511355+yufeih@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 27, 2025

@copilot write a test case in https://github.com/dotnet/docfx/blob/main/test/Docfx.Dotnet.Tests/XmlCommentUnitTest.cs to verify that the case fails before the code change and pass after the code chang...

I've added a test case in XmlCommentUnitTest.cs to verify the fix for list rendering in remarks. The test case (Issue10559) demonstrates that with our fix, lists in XML remarks are properly rendered as HTML lists rather than as code blocks.

The test shows that the XML list:

<list type="bullet">
    <item>
        <description>Item 1.</description>
    </item>
    <item>
        <description>Item 2.</description>
    </item>
</list>

Is correctly rendered as:

<ul><li>
        Item 1.
    </li><li>
        Item 2.
    </li></ul>

See commit ae55894.

Copilot finished work on behalf of yufeih May 27, 2025 07:27
var pipeline = new MarkdownPipelineBuilder()
.UseMathematics()
.EnableTrackTrivia()
.Configure(extensions: "advanced-tasklists-noindentcodeblock") // Disable indented code blocks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought, It should not disable indented code blocks feature here.

Th root cause of problem is <list> tag contents are handled as Markdown document.
Markdown specification require Empty Line when mixing markdown/HTML tags.

So, It need to add logics to insert empty line before/after <list> tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] List in remark is not rendered correctly
3 participants