Skip to content

Unable to get docstring summary, and supress the remainder of the docstring #139

Open
@bschollnick

Description

@bschollnick

Description of the bug

From my reading of the documentation, I don't see any way to supress the docstring, and only show the summary line(s) of the docstring.
We are hoping to have 2 different blocks.... One will only show the summary (being a "non-technical") summary, and then another in a collapsed annotation that has the whole 9 yards.

This allows the documentation to be used for non-technical (non-programmers), using the summary only listing, And allow programmers to view the same documentation.

I see a "summary" option,

summary (bool | dict[str, bool]): Whether to render summaries of modules, classes, functions (methods) and attributes.

But it seems to do nothing...

e.g. summary: true, appears to do nothing.

To Reproduce

 Example:
::: application.checkers.hoster.hostingclass
    options:
      show_source: false
      heading_level: 2
      parameter_headings: false
      merge_init_into_class: true
      docstring_options:
        ignore_init_summary: false
        trim_doctest_flags: false
      summary: true
      show_docstring_parameters: false
      show_docstring_raises: false
      show_docstring_receives: false
      show_docstring_yields: false
      show_docstring_warns: false
      show_docstring_description: false
      show_docstring_returns: false
      show_docstring_examples: false

As mentioned, using mkdocs w/mkdocstring[python] plugin, seems to work fine except I can't get the summary option to work.

Expected behavior

The ability to show the docstring summary, without the rest of the docstring.

Environment information

python -m mkdocstrings_handlers.python.debug  # | xclip -selection clipboard

> No module named mkdocstrings_handlers.python.debug

The following libraries are loaded:
mkdocs 1.5.3 Project documentation with Markdown.
mkdocs-autorefs 1.0.1 Automatically link across pages in MkDocs.
mkdocs-material 9.5.10 Documentation that simply works
mkdocs-material-extensions 1.3.1 Extension pack for Python Markdown and MkDocs Material.
mkdocstrings 0.24.1 Automatic documentation from sources, for MkDocs.
mkdocstrings-python 1.7.3 A Python handler for mkdocstrings.

Metadata

Metadata

Assignees

Labels

configRelated to configuration optionsfeatureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions