File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/mkdocstrings_handlers/python Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -539,11 +539,20 @@ def do_as_attributes_section(
539539 Returns:
540540 An attributes docstring section.
541541 """
542+ def _parse_docstring_description (attribute : Attribute ) -> str :
543+ if attribute .docstring is None :
544+ return ""
545+ lines = attribute .docstring .value .lstrip ().split ("\n " , 1 )
546+ if ":" in lines [0 ]:
547+ _ , line = lines [0 ].split (":" , 1 )
548+ lines = [line , * lines [1 :]]
549+ return lines [0 ]
550+
542551 return DocstringSectionAttributes (
543552 [
544553 DocstringAttribute (
545554 name = attribute .name ,
546- description = attribute . docstring . value . split ( " \n " , 1 )[ 0 ] if attribute . docstring else "" ,
555+ description = _parse_docstring_description ( attribute ) ,
547556 annotation = attribute .annotation ,
548557 value = attribute .value , # type: ignore[arg-type]
549558 )
You can’t perform that action at this time.
0 commit comments