You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to #667 but, I think, more narrow in scope.
We use xml documentation comments in code but have not been able to find a way to standardize formatting. Since we are already using csharpier to format our c# files, it would be really helpful if xml documentation comments were supported as well.
The text was updated successfully, but these errors were encountered:
This is not a fix for the original problem but a manual workaround if you are simply looking to format the documentation you are currently writing.
Dirty workaround using prettier manually
1. Install prettier
$ npm install prettier
2. Copy documentation to a new .html file
Also remove leading ///
`MyClass.cs`
/// <summary>Some summary</summary>/// <remarks>/// <para>/// This documentation is really long and requires that the formatter produces multiple lines when/// formatted with/// the <c>printWidth</c>/// we are going with./// </para>/// <code>/// Console.WriteLine(/// """/// Hello World!/// """/// );/// </code>/// <para>/// Another/// badly <see cref="Formatting"/> formatted/// para./// </para>/// </remarks>publicclassMyClass{}
documentation.html (input)
<summary>Some summary</summary>
<remarks>
<para>
This documentation is really long and requires that the formatter produces multiple lines when
formatted with
the <c>printWidth</c>
we are going with.
</para>
<code>
Console.WriteLine(
"""
Hello World!
"""
);
</code>
<para>
Another
badly <seecref="Formatting"/> formatted
para.
</para>
</remarks>
4. Add <!-- prettier-ignore --> before any <code> blocks etc. that should not be formatted
This will only affect the tag immediately following.
<summary>Some summary</summary>
<remarks>
<para>
This documentation is really long and requires that the formatter produces multiple lines when
formatted with
the <c>printWidth</c>
we are going with.
</para>
+ <!-- prettier-ignore -->
<code>
Console.WriteLine(
"""
Hello World!
"""
);
</code>
<para>
Another
badly <see cref="Formatting"/> formatted
para.
</para>
</remarks>
<summary>Some summary</summary>
<remarks>
<para>
This documentation is really long and requires that the formatter
produces multiple lines when formatted with the <c>printWidth</c>
we are going with.
</para>
<!-- prettier-ignore -->
<code>
Console.WriteLine(
"""
Hello World!
"""
);
</code>
<para> Another badly <seecref="Formatting" /> formatted para. </para>
</remarks>
5. Reinsert ///, remove <!-- prettier-ignore --> and copy back to your .cs file
You can use search and replace by regex ^ -> /// (note the trailing space in the replace expression!) to reinsert /// easily.
This is related to #667 but, I think, more narrow in scope.
We use xml documentation comments in code but have not been able to find a way to standardize formatting. Since we are already using csharpier to format our c# files, it would be really helpful if xml documentation comments were supported as well.
The text was updated successfully, but these errors were encountered: