Re: [sphinx-users] Custom Directive: how to correctly create reference to a class

2020-12-12 Thread Komiya Takeshi
I guess you used pending_xref nodes after the reading phase. They are generated during the reading phase and converted into the reference nodes on the resolving phase. As a result, writer components don't handle them. Thanks, Takeshi KOMIYA 2020年12月12日(土) 23:26 Nic30original : > > Nice, that was

Re: [sphinx-users] Custom Directive: how to correctly create reference to a class

2020-12-12 Thread Nic30original
Nice, that was the answer what I was hoping for. I tried it before, but I did it in Element visit_html which resulted in ``` Exception occurred:   File "/usr/local/lib/python3.8/dist-packages/sphinx/writers/html5.py", line 793, in unknown_visit     raise NotImplementedError('Unknown node: ' +

Re: [sphinx-users] Custom Directive: how to correctly create reference to a class

2020-12-12 Thread Komiya Takeshi
Hi, Bingo! Sphinx uses the pending_xref nodes to realize the cross-reference feature. Please try to make a node that refers python class like this: ``` node = sphinx.addnodes.pending_xref(refdomain='py', reftype='class', reftarget='stringio.StringIO') node += nodes.Text('stringio.StringIO) ```

[sphinx-users] Custom Directive: how to correctly create reference to a class

2020-12-09 Thread Nic30
Basicaly I am trying to generate reference element to a class. I am able to get a class object in `Directive.run()` which I want to reference in documentation. Currently I am using `sphinx.util.typing.stringify` to get a string and then returning `docutils.nodes.Text` I would like to create hr