pdoc3 / pdoc

:snake: :arrow_right: :scroll: Auto-generate API documentation for Python projects
https://pdoc3.github.io/pdoc/
GNU Affero General Public License v3.0
1.13k stars 146 forks source link

Numpydoc "Examples" section formatting #263

Closed thomasfrederikhoeck closed 4 years ago

thomasfrederikhoeck commented 4 years ago

Expected Behavior

Numpy have the section "Examples" which shows how to use the code. I would be nice to show this in the same way as parameters and returns.

Actual Behavior

Right now it is stripped from the docstring so if using the following the "Examples" is not shown in the genreated HTML.

def my_func(
    server: str,
) -> sqlalchemy.engine.Engine:
    """
    Convenience function for generating SQLAlchemy Engine. 

    Parameters
    ----------
    server : str
        Name or IP address of the server. 

    Returns
    -------
    sqlalchemy.engine.Engine

    Examples
    -------
    >>> mymodule .sql import my_func
    """

Steps to Reproduce

  1. Copy the docstring
  2. Run pdoc --html mymodule

Additional info

kernc commented 4 years ago

What do you mean stripped away? :astonished: This works for me.

Screenshot_2020-09-22 foo API documentation

thomasfrederikhoeck commented 4 years ago

Okay, it was not stripped away (but more temporarily hidden). 😃 If I'm using --http and the function is in the __all__ for the module it is not updated (even when I hit F5) when I change the docstring. It only happens if it is "lifted a level up" with __all__an to if to go to the file where the function is defined.

kernc commented 4 years ago

It only happens if it is "lifted a level up" with __all__an to if to go to the file where the function is defined.

I don't think I fully comprehend.

Can you maybe open a new issue with a minimal reproducible example? IIUC, it's not the Examples section in particular, but a stale docstring in general? Must be some caching issue ... :thinking:

thomasfrederikhoeck commented 4 years ago

Will do tomoz.