Replies: 74 comments 4 replies
-
One nagging question I've been having: What do |
Beta Was this translation helpful? Give feedback.
-
@sharwell please explain that question. Is the backtick a commonly used character in Turkish? |
Beta Was this translation helpful? Give feedback.
-
@whoisj My mistake. Turkish keyboards can type ¹ NumLock use only required on laptops |
Beta Was this translation helpful? Give feedback.
-
You're advocating switching to backticks in quite a few scenarios in your example. How do you propose that the compiler resolve those references properly? |
Beta Was this translation helpful? Give feedback.
-
In theory the compiler know the name scoping of the method or type being decorated. Use the same rules that would apply to the code contained within. How does the compiler ever know what a piece of code is referencing? Name scoping rules. 😏 |
Beta Was this translation helpful? Give feedback.
-
@sharwell I hadn't realized that the backtick character was absent from Turkish (or any for that matter) keyboards. Interesting 😔 |
Beta Was this translation helpful? Give feedback.
-
My initial proposal would be:
|
Beta Was this translation helpful? Give feedback.
-
As I've seen, these can quickly become famous last words. 😆 Luckily you're asking for markdown which specs an escape for the backtick. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
How is different when it's a keyword or a type name? It's still edit: @sharwell points out that C# already has a mechanism for resolving a variable vs keyword collisions: the |
Beta Was this translation helpful? Give feedback.
-
💭 My bigger concern is cases where you want to write "code" that isn't meant to reference anything. For cases where a reference is desired, it's also desired to warn if the resolution fails. But what about cases where you aren't trying to reference anything? |
Beta Was this translation helpful? Give feedback.
-
I've thought about this quite a bit in the past. How would you identify
|
Beta Was this translation helpful? Give feedback.
-
We could either use / keep the |
Beta Was this translation helpful? Give feedback.
-
But sometimes I actually want two-para summaries because remarks don't show up in intellisense if there is a summary element. |
Beta Was this translation helpful? Give feedback.
-
Interesting conversations here (thanks for the /ht @BillWagner) … with regards to the questions about markdown: docs.microsoft.com uses MarkDig for working with markdown. This solves the spec question (it is commonmark compliant), and the AST question. |
Beta Was this translation helpful? Give feedback.
-
At minimum, my proposal would need two changes to the language specification:
|
Beta Was this translation helpful? Give feedback.
-
While it sounds more practical integration wise, I'm not entirely sure it would be a good idea to parse precisely a Markdown comment fragment with precise CommonMark handling for all markdown elements at Roslyn compilation/intellisense time, as it will require to translate all CommonMark to a valid XML-doc comments... Just speculating from my experience with CommonMark parsing, but implementation wise, it would be easier to only work on the subset that has to deal with code references and output XML doc files still with markdown embedded comments. Precise CommonMark parsing could be delayed until rendering. You would not need to have an entire CommonMark compliant parser in Roslyn, it could work for example only on inline elements (in CommonMark spec terms), and maybe not working on all syntax elements but just handling the escape |
Beta Was this translation helpful? Give feedback.
-
The intent of compilation time translation to XML documentation is providing the following guarantees:
This binds the Markdown syntax used for authoring documentation comments to the backwards compatibility rules of the C# language. I do not see a way this proposal could ever be successful without removing this coupling (it could move forward, but it would be frozen in time and not allow for extensions/variants/modifications of the Markdown used for documentation). Eventually we'd be back in the same situation we are in today.
This is an implementation detail, but the goal would certainly be avoiding design-time translation of Markdown to XML except for cases where the result needs to be presented to the user (e.g. the user hovered over a code reference and Quick Info needs to show). |
Beta Was this translation helpful? Give feedback.
-
Not sure to follow this part... Could you elaborate?
It sounds contrary to what you are explaining just before ("translation to XML documentation")... How would that work for all the rest of basic markdown formatting? Would you translate markdown list to xml-doc |
Beta Was this translation helpful? Give feedback.
-
It does/doesn't. Part of Roslyn is that this is also shelled out to a real .Net Xml library to do verification.
That's fine. But it definitely raises the costs here substantially. Because Roslyn then needs to now meet this 'spec' (which from above hasn't even been standardized yet). |
Beta Was this translation helpful? Give feedback.
-
I woudl very much like this to not be part of the language.
I really like these rules. This helps carve out the language space, while also giving broad leeway in the impl to do the best we can, but know that we can and likely will have to change/tweak things in the future. |
Beta Was this translation helpful? Give feedback.
-
If only someone had written such an extensibility subsystem for Roslyn ;-) On a serious note, i think this would be a fine way to proceed. You can use the VirtualChar system to represent the contents of non |
Beta Was this translation helpful? Give feedback.
-
This really needs to be a thing. :) |
Beta Was this translation helpful? Give feedback.
-
Found this while looking if C# comments could be done using markdown instead of cumbersome I mean I would like to write and IntelliSense to understand something like this:
Instead of this mess:
Never gonna happen though I think :/ |
Beta Was this translation helpful? Give feedback.
-
2021 is almost over!!Does any solution about using Markdown or Yaml as comments instead of XML comments? |
Beta Was this translation helpful? Give feedback.
-
It's a compromise, how about introducing only top-level XML tags? /// <documentation type="markdown"><![CDATA[
/// Returns the absolute value of a double-precision floating-point number.
/// # Parameters
/// - `value`: `Double`:
/// A number that is greater than or equals to `MinValue`, but less than or equal to `MaxValue`.
/// # Returns
/// `Double`:
/// A double-precision floating-point number, x, such that 0 ≤ x ≤ `MaxValue`.
/// ]]></documentation>
public static double Abs(double value); Although a little verbose style, |
Beta Was this translation helpful? Give feedback.
-
I suggest to not overcomplicate things by thinking about Markdown-replacements for each and every one of the XML documentation elements, since they work fine as they are. Just do those things:
|
Beta Was this translation helpful? Give feedback.
-
@sharwell proposal is great: https://gist.github.com/sharwell/ab7a6ccab745c7e0a5b8662104e79735 |
Beta Was this translation helpful? Give feedback.
-
Please make this a thing. XML for documentation is just too noisy. Even Java is contemplating the switch to markdown |
Beta Was this translation helpful? Give feedback.
-
Today we have documentation comments which rely solely on XML, which many (myself included) find ugly, unnecessarily complex, and difficult to read. My ask is specifically to allow for the use of Markdown backtick characters to used as delimiter (book ends) for bits of code which should resolve to real types, values, etc. much in the way
<see cref=""/>
,<paramref name=""/>
, and<see langword=""/>
operate today. I would avoid worrying about a method for escaping the backtick character, as it is unlikely that would be necessary.Example of current XML style:
Example of Markdown style:
Another suggestion was to allow YAML in place of the XML, which looks even nicer to be honest, but is not really the point of this issue.
Beta Was this translation helpful? Give feedback.
All reactions