You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into a situation where sphinx-autodoc-typehints is inserting the rtype signature without creating space between rtype and the previous paragraph so it isn't being rendered correctly in the final html output:
I'm not sure I understand enough about the codebase but it seems to me the problematic area is inside _inject_rtype.
I noticed a related ticket from a few years ago introduced these lines of code:
ifinsert_index==len(lines) andnotr.found_param:
# ensure that :rtype: doesn't get joined with a paragraph of textlines.append("")
insert_index+=1
I wonder if it would be better to just explicitly check if the previous line is not blank. If it isn't then insert a blank line to make sure that rtype won't be joined with the previous paragraph of text. For example we could change these lines to be:
ifinsert_index>0andinsert_index<=len(lines) andlines[insert_index-1]:
# ensure that :rtype: doesn't get joined with a paragraph of textlines.insert(insert_index, "")
insert_index+=1
The text was updated successfully, but these errors were encountered:
I wonder if it would be better to just explicitly check if the previous line is not blank. If it isn't then insert a blank line to make sure that rtype won't be joined with the previous paragraph of text.
That sounds reasonable, if you add a test validating test a PR is welcome.
I've run into a situation where
sphinx-autodoc-typehints
is inserting the rtype signature without creating space between rtype and the previous paragraph so it isn't being rendered correctly in the final html output:Instead what I expected to see is:
I am using
sphinx-autodoc-typehints==2.0.0
.To help, I've created a repository with a MRE here: https://github.com/tjsmart/sphinx-autodoc-typehints-rtype-issue.
I'm not sure I understand enough about the codebase but it seems to me the problematic area is inside
_inject_rtype
.I noticed a related ticket from a few years ago introduced these lines of code:
I wonder if it would be better to just explicitly check if the previous line is not blank. If it isn't then insert a blank line to make sure that rtype won't be joined with the previous paragraph of text. For example we could change these lines to be:
The text was updated successfully, but these errors were encountered: