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

Proposal: allow 'href' attributes (particularly in <see> and <seealso> elements) #1764

Open
sharwell opened this issue Aug 2, 2018 · 7 comments
Assignees
Labels
Milestone

Comments

@sharwell
Copy link
Member

sharwell commented Aug 2, 2018

Motivation

Currently, the C# language does not provide clear facilities for referencing external content addressable by a URI. This leads to confusion among developers regarding the best plan to include such content in documentation:

Detailed design

This proposal involves three components, each of which should be formalized for inclusion in the language specification.

  • The href attribute of documentation comment elements is defined, with the value as a URI. The compiler MAY report a warning if the value is not a valid URI.

  • The see and seealso elements are updated to allow for the use of href attribute. The compiler MAY report a warning if both the cref and href attributes are used for the same reference. The following shows examples of how this may appear:

    <see href="https://github.com/dotnet/csharplang/"/>
    <see href="https://github.com/dotnet/csharplang/">The official repo for the design of the C# programming language</see>
  • The see and seealso elements are updated to indicate the content of the element, if provided, should be used as the display text of the reference.

This change is likely to not require any core changes in the behavior of the compiler. However, tools (including the IDE component of dotnet/roslyn) are likely to require updates to ensure correct presentation of these references.

@sharwell sharwell changed the title Proposal: allow 'href' attributes Proposal: allow 'href' attributes (particularly in see and seealso elements) Aug 2, 2018
@sharwell sharwell changed the title Proposal: allow 'href' attributes (particularly in see and seealso elements) Proposal: allow 'href' attributes (particularly in <see> and <seealso> elements) Aug 2, 2018
@alrz
Copy link
Member

alrz commented Aug 10, 2018

I wish we could invest in markdown doc comments instead. XML is not a great format for in-code documentation.

@artus
Copy link

artus commented Aug 10, 2018

I saw someone writing their documentation in yaml instead of xml, which is also a bit more human-readable than xml.

@michael-hawker
Copy link

@sharwell this has been open for a while and is labeled blocked, what is it blocked on?

@sharwell
Copy link
Member Author

@michael-hawker IIRC, the language team concluded they are more interested in reviewing a complete proposal that addresses many outstanding usability issues related to documentation comments, as opposed to trying to review a bunch of small changes.

@michael-hawker
Copy link

@sharwell isn't this more of a bug than a proposal since other well-known tools in the xmldoc ecosystem support have supported this syntax for a while now?

Like DocFX: https://dotnet.github.io/docfx/api/Microsoft.DocAsCode.DataContracts.ManagedReference.LinkType.html
And Sandcastle: https://ewsoftware.github.io/XMLCommentsGuide/html/983fed56-321c-4daf-af16-e3169b28ffcd.htm

It's also called out in our docs here: https://docs.microsoft.com/dotnet/csharp/programming-guide/xmldoc/see

It also seems to be supported in Roslyn: https://github.com/dotnet/roslyn/blob/main/src/Features/Core/Portable/DocumentationComments/AbstractDocumentationCommentFormattingService.cs#L324-L345

So I'm even more confused about what's what.

@KalleOlaviNiemitalo
Copy link

see/@href, see/@langword, and seealso/@href were added to the C# 6 standard draft in dotnet/csharpstandard@ffa424a.

@ZacharyPatten
Copy link

ZacharyPatten commented Jul 6, 2021

For projects with API documentation such as projects using docfx it would be nice if there was a standardized way to link to the documentation of a code member from the XML. I opened this discussion on docfx: dotnet/docfx#7458
However I recommended a tool that automatically adds the link to the <summary> node, because that seems like the only real place we have at the moment.

I wish there was a standard xml node like <link> that would be recognized by Roslyn, so we don't have to tack it on the end of <summary>.

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

No branches or pull requests

8 participants