Search code examples
pythongithubdocumentationwikidocstring

How to display docstrings into a repository's Wiki?


I have a python project that contains docstrings for every function, method and class. How can I automatically display it in a user friendly way into the repository's wiki, or some other dedicated place in the repository? (I don't know what place is typically used for such things)

Note: the question is about python docstrings, but if there is some general way to do it for all doc types (e.g XML docs in C#, Javadoc in Java, etc..) in GitHub it would be better


Solution

  • Use pydoc to pipe your docstring to a .md file and upload that to your Github repo wiki:

    Example for the sys library:

    Windows CMD

    python -m pydoc sys > sys.md
    

    Linux/WSL/OS X

    pydoc sys > sys.md