Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 1, 2025

This PR enhances the XML documentation to better explain the href attribute and <br/> tag usage in C# documentation comments, addressing confusion about when and how to use these features.

Changes Made

Enhanced href attribute documentation

  • Added clear explanation that href creates clickable links while cref with URLs does not
  • Added practical example showing the difference between cref and href for external URLs
  • Enhanced the href attribute section with guidance on when to use it vs cref

Improved <br/> tag documentation

  • Added comprehensive example showing the difference between <para> (double-spaced) and <br/> (single-spaced) formatting
  • Clarified when to use each tag for different spacing needs

Added working code examples

  • Created HrefAndBrExamples.cs with practical examples that demonstrate the concepts
  • Examples show the compiler warning (CS1584) when using cref with URLs, reinforcing why href should be used instead
  • Code examples are properly tagged for snippet inclusion in documentation

Updated introduction section

  • Added note explaining that HTML tags like <br/> work in IntelliSense tooltips and generated documentation
  • Made HTML tag support more prominent in the overview

Example of the key difference addressed:

/// <summary>
/// This method demonstrates URL linking:
/// <see cref="https://docs.microsoft.com/dotnet/csharp"/> (won't create clickable link)
/// <see href="https://docs.microsoft.com/dotnet/csharp">C# documentation</see> (creates clickable link)
/// </summary>
public void ExampleMethod() { }

The documentation now clearly addresses the original concern that these features were available in IntelliSense but not properly documented.

Fixes #18859.


💡 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.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/xmldoc/recommended-tags.md docs/csharp/language-reference/xmldoc/recommended-tags

Copilot AI changed the title [WIP] see href attribute and br Enhance XML documentation for href attribute and br tag usage Jul 1, 2025
Copilot AI requested a review from BillWagner July 1, 2025 18:08
Copilot finished work on behalf of BillWagner July 1, 2025 18:08
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This is a great start. I have a couple small comments.

Copilot AI requested a review from BillWagner July 2, 2025 13:43
Copilot finished work on behalf of BillWagner July 2, 2025 13:43
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This is now ready for final approval

@BillWagner BillWagner marked this pull request as ready for review July 2, 2025 13:45
@BillWagner BillWagner requested a review from a team as a code owner July 2, 2025 13:45
@IEvangelist IEvangelist merged commit 299cc19 into main Jul 2, 2025
10 checks passed
@IEvangelist IEvangelist deleted the copilot/fix-18859 branch July 2, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

see href attribute and br

3 participants