Skip to content

v1.12.7 shows "Content block expected for the "note" directive; none found" with multiple lines of notes #312

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

Closed
ysk24ok opened this issue Jan 23, 2023 · 3 comments · Fixed by #316
Labels

Comments

@ysk24ok
Copy link

ysk24ok commented Jan 23, 2023

Hello maintainers.

I have a function which has multiple lines of notes, like this:

def func(param1: str) -> None:
    """Do something.

    Args:
        param1: A parameter.

    Note:
        Some notes.
        Some more notes.
    """
    print("Do something")

Using v1.12.7, running sphinx-build throws an error and a warning like this:

ERROR: Content block expected for the "note" directive; none found.
WARNING: Explicit markup ends without a blank line; unexpected unindent.

Debugging with -vv option, logs show how the method is converted. Seems :rtype: is inserted in a wrong place.

.. py:function:: func(param1)
   :module: pykit.grpc

   Do something.

   :type param1: :py:class:`str`
   :param param1: A parameter.

   .. note::
   :rtype: :py:obj:`None`

      Some notes.
      Some more notes.

This code works fine with v1.12.1, but fails with v1.12.7.
A function with one line of notes works fine with both versions.
Is this an expected or unexpected behavior?

@hoodmane
Copy link
Collaborator

Is this an expected or unexpected behavior?

Unexpected. Thanks for the report!

@hoodmane hoodmane added the bug label Jan 23, 2023
@hoodmane
Copy link
Collaborator

This is another problem caused by docutils being inconsistent about adding line numbers to things. I added an upstream bug report:
https://sourceforge.net/p/docutils/bugs/465/
For now we can just patch it.

@ysk24ok
Copy link
Author

ysk24ok commented Jan 23, 2023

@hoodmane Thank you for the quick fix! Would it be possible to release a patch version (v1.12.8)?

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

Successfully merging a pull request may close this issue.

2 participants