Open jwodder opened 9 months ago
Ah I remember that. I think the trick is to put it at the top of the documentation and with newlines around. Not sure it will work though because I don't remember whether I already pushed a fix for that.
@jwodder does adding newlines around :meta private:
fix your issue?
@picnixz Yes, but that shouldn't be necessary.
It's probably something from docutils actually where each 'block' is delimited by newlines. It's needed for the state machine otherwise it incorrectly detects fields as being part of a group it should not (in your example, the :meta:
would be part of the signature but it's actually for the whole docstring).
@picnixz So you're saying that, when I don't add a newline, then the :meta:
is associated with the function signature rather than the whole docstring, and that's why it doesn't do anything? Then why does :meta:
take effect when I put it above the :raises:
yet still in the same block, like this:
def afunction(n: int) -> str:
"""
Do secret things.
:param int n: Magic number
:returns: Wouldn't you like to know?
:meta private:
:raises ValueError:
- if the moon is full
- if I feel like it
"""
raise NotImplementedError
Oh, then indeed it's an issue. I'll try investigating it as part of :meta:
itself (https://github.com/sphinx-doc/sphinx/issues/11310).
Describe the bug
The
autodoc
extension is supposed to hide members with the:meta private:
info field, but if this field occurs after an info field containing indented text (even if there are non-indented fields in between), then:meta private:
will not be honored.How to Reproduce
(Complete MVCE project can be found at https://github.com/jwodder/sphinx-bug-20231017.)
index.rst
:src/mvce/__init__.py
:When the docs are built,
afunction()
will be included in the documentation despite the:meta private:
field. If:meta private:
is moved above the:raises:
field or the:raises:
field is deleted,afunction()
will be absent when the docs are rebuilt.Environment Information
Sphinx extensions
Additional context
No response