Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only top level headings are rendered richly #57

Open
joelostblom opened this issue Dec 2, 2022 · 2 comments
Open

Only top level headings are rendered richly #57

joelostblom opened this issue Dec 2, 2022 · 2 comments

Comments

@joelostblom
Copy link

I am trying to us docrepr to render docstrings in JupyterLab, but it seems like only top level headings in the docstring are rendered, not other headings, code, etc. This is with the following versions:

# Name                    Version                   Build  Channel
docrepr                   0.2.0              pyh050c7b8_0    conda-forge
jupyterlab                3.3.4              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge

image

@CAM-Gerlach
Copy link
Member

Hmm, I cannot seem to reproduce the issue on docrepr's end, either on the given function (which is included in docrepr's test suite), or in my own tests of the stated problem (nested heading levels).

Multiple tests, both unit tests and visual regression tests in our suite that test docrepr with the same function as above, np.sin—though to note, it does not include the extra sections that were added by the JupyterLab plugin that wraps docrepr, and all of them pass across all three major OSes. You can see the visual regression test output on, e.g. Linux here.

Furthermore, I created an example function with a docstring containing multiple heading levels, and tested it on Windows on both a brand new environment with Python 3.10, Sphinx 5.3.0 and IPython 8.4.0, and the older Python 3.9, Sphinx 4.5.0 and IPython 7.30.1, and neither could reproduce the issue. Here's the minimal example:

from IPython.core.oinspect import Inspector
import docrepr.sphinxify
def test_fn():
    """
    Test test

    Heading L1
    ==========

    Some text

    Heading L2
    ----------

    Some more text
    """
    pass

oinfo = Inspector().info(test_fn)
path = docrepr.sphinxify.rich_repr(oinfo)
print(path)

The output was:

image

Can you reproduce the issue running the above, or another minimal reproducible example using docrepr (rather than JupyterLab)?

Otherwise, unless @martinRenou or the other Quanstack folks have any immediate insights here from the information provided, you might be better off reporting this issue to JupyterLab instead, since they will be able to isolate what's happening on their end, and determine if they can fix it or something needs to be changed on docrepr's side—I wasn't really involved with the work on the JupyterLab side, that was all @martinRenou & co; I just help maintain docrepr.

Thanks!

@martinRenou
Copy link
Collaborator

Thanks for the ping, I'll try to find time to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants