Search code examples
mkdocs

MkDocs, mkdocstrings - attach only module docstring


When I want to attach the docstrings from bar module in my documentation, I put

::: foo.bar

in the markdown file.

It attaches all the docstrings in the bar file - module docstring and Bar class docstrings. When I want to attach just Bar classes docstrings, the syntax is:

::: foo.bar.Bar

Now I'd like to reference only module docstring without the class. How can I do that?


Solution

  • Use the members option:

    ::: foo.bar
        options:
          members: no
    

    See https://mkdocstrings.github.io/python/usage/#globallocal-options.