Skip to content

Commit

Permalink
fix: Incorrect output in autodoc (#960)
Browse files Browse the repository at this point in the history
Autodoc output was not as expected
Additionally, description was still in the ParamTable object, but can
have newlines, so rendering broke.
  • Loading branch information
jnumainville authored Oct 29, 2024
1 parent 4114ecc commit 82f7125
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions sphinx_ext/deephaven_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ class FunctionMetadata(TypedDict):
name: str


# total is False to allow for popping some keys
class SignatureData(TypedDict):
parameters: Params
return_description: str
return_type: str
return_description: NotRequired[str]
return_type: NotRequired[str]
module_name: str
name: str
description: str
description: NotRequired[str]


SignatureValue = Union[str, Params]
Expand Down Expand Up @@ -306,15 +305,17 @@ def to_mdx(node: sphinx.addnodes.desc) -> docutils.nodes.comment:
"""
result = extract_desc_data(node)

dat = json.dumps(result)
# these need to be popped in case they have newlines which will break ParamTable rendering
return_description = result.pop("return_description")
return_type = result.pop("return_type")
description = result.pop("description")

return_description = result["return_description"]
return_type = result["return_type"]
dat = json.dumps(result)

autofunction_markdown = (
f"{AUTOFUNCTION_COMMENT_PREFIX}"
rf"{return_description}<br /><br />"
rf"**Returns:** {return_type}<br /><br />"
rf"{description}<br /><br />"
rf"**Returns:** `{return_type}` {return_description}<br /><br />"
rf"<ParamTable param={{{dat}}} />"
)

Expand Down

0 comments on commit 82f7125

Please sign in to comment.