liran-funaro / sphinx-markdown-builder

A Sphinx extension to add markdown generation support.
https://pypi.org/project/sphinx-markdown-builder
MIT License
32 stars 14 forks source link

[BUG] unknown node type: desc_returns #19

Open haukex opened 3 months ago

haukex commented 3 months ago

Describe the bug When using autodoc to generate the documentation for a module, for a function with a return type, the warning docstring of ...: WARNING: unknown node type: <desc_returns: ...> occurs and the return type is not part of the output. For example: https://gist.github.com/haukex/2b012e1490b538210d7279b94bffc4d5#file-foo-py

To Reproduce Steps to reproduce the behavior:

  1. git clone https://gist.github.com/2b012e1490b538210d7279b94bffc4d5.git bug_desc_returns
  2. cd bug_desc_returns
  3. pip install -r requirements.txt
  4. make
  5. Output includes .../bug_desc_returns/foo.py:docstring of foo.foo:1: WARNING: unknown node type: <desc_returns: <#text: 'int'>>
  6. cat output/markdown/index.md:

    <a id="module-foo"></a>
    
    Hello, World!
    
    ### foo.foo(bar: str)
    
    Foo!

    Note how the return type int is missing.

Expected behavior I would expect the warning not to occur and the function signature to include -> int.

Environment Python 3.12 on Ubuntu Linux

Additional context I'm not sure, but it seems to me like sphinx_markdown_builder/translator.py needs to add support for sphinx.addnodes.desc_returns?