Open Sangwon91 opened 2 years ago
Is your feature request related to a problem? Please describe. If I use typehints like this, I get the same result as expected from the documentation.
in code:
def func(value: int | str) pass
in documentation:
value (int | str) - description about value.
But adding None converts it to a hard-to-read form. in code:
None
def func(value: int | str | None = None) pass
value (Optional[Union[int, str]]) - description about value.
I think the output should look like this.
value (int | str | None) - description about value.
Does Sphinx already have these features? If not, it would be nice if Sphinx implemented such a feature.
This has been implemented in the sphinx-immaterial theme:
https://jbms.github.io/sphinx-immaterial/apidoc/python/index.html#confval-python_transform_type_annotations_pep604
You might consider creating a pr to upstream that feature into sphinx itself.
Is your feature request related to a problem? Please describe. If I use typehints like this, I get the same result as expected from the documentation.
in code:
in documentation:
But adding
None
converts it to a hard-to-read form. in code:in documentation:
I think the output should look like this.
Does Sphinx already have these features? If not, it would be nice if Sphinx implemented such a feature.