Doraku / DefaultDocumentation

Create a simple markdown documentation from the Visual Studio xml one.
MIT No Attribution
157 stars 26 forks source link

docs are generated for internals members, classes, etc... #59

Closed IggaF closed 3 years ago

IggaF commented 3 years ago

Hi,

I see that docs are generated also for internals. Is there a way to generate docs for publics only? Maybe some configuration to choose desired access modifiers for generation?

Thanks, IF

Doraku commented 3 years ago

Hey, indeed. My idea was that if you added some xml documentation, you probably want to see it in the generated documentation. If there is some exception, you can add a <exclude /> element on a full type or specific members to exclude it from the documentation generation.

Doraku commented 3 years ago

But I guess I could add a configuration to state for which visibility (private, protected, public) you want to generate documentation so you don't have to put <exclude /> everywhere.

IggaF commented 3 years ago

Hey @Doraku :) You are correct, but such config would be way more convenient and usable Especially if you think of the case when doc generation is used on existing project with hundreds (or more) classes -> adding to everything will be very tiresome :)

aremes commented 3 years ago

I ran into this issue yesterday and was amused that this issue had just been created. :) Anways, here's the problem with \ (aside from what @IggaF already mentioned):

I extensively use string resources for (localized) error messages. The XY.resx files cause the automatic generation of a XY.Designer.cs file exposing the strings as static properties for use in code. Unfortunately, MS decided to throw XML comments into that autogenerated file (it does help with intellisense when using the strings, i guess.) so now every assembly in my library has an extra documentation page for the Properties class. ..which absolutely nobody needs as they are only for internal use..

So as you can see: adding \ to code which is dynamically generated by tooling is simply impossible.

@Doraku do you accept/encourage pull requests? (in case i have time to propose a solution)

Doraku commented 3 years ago

Unfortunately, MS decided to throw XML comments into that autogenerated file (it does help with intellisense when using the strings, i guess.) so now every assembly in my library has an extra documentation page for the Properties class. ..which absolutely nobody needs as they are only for internal use..

haha I didn't think of that x) I was already convinced to do it, 200% now.

Quick workaround if the generated types are alone in a namespace, you can put a namespace documentation with the exclude tag:

namespace MyAssembly
{
    namespace Properties
    {
        /// <exclude />
        internal static class NamespaceDoc { }
    }
}

Anyway of course pull requests adding interesting feature like this or fixing bug will be greatly appreciated :) It would be quite easy to do too: