NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
458 stars 102 forks source link

`IndexError` while processing short module path #167

Closed g6123 closed 3 years ago

g6123 commented 3 years ago

Hi, thank you for the amazing library.

Here is a bug report I found in pydoc-markdown, while trying to render a document for modules with the short path names. If the module path consists of only one part such as views, http (instead of multiple parts like generic.views, http.responses), following error occurs:

  File "<...>/lib/python3.7/site-packages/pydoc_markdown/contrib/renderers/markdown.py", line 213, in _render_header
    relative_module_name=obj.name.rsplit(".", 1)[1]
IndexError: list index out of range

Can I make a simple PR to fix this?