As part of a custom directive I am trying to support nested references. I have re-worked the todo example to demonstrate what I am looking for.
The complete repo is here:
https://github.com/martynp/sphinx_nested
The commit with the changes I would like to work are here:
https://github.com/martynp/sphinx_nested/commit/c973db1bbb4018306bea4b3fdd465c795ac1c1ec
Which makes someotherfile.rst:
bar
===
Some more text here... :ref:`foo reference`
.. todo:: Fix that :ref:`foo reference`
The error I get is:
preparing documents... done
/home/martyn/work/sphinx_example/someotherfile.rst:6: WARNING: unknown node type: <pending_xref: <inline...>>
Exception occurred:
File "/home/martyn/.local/lib/python3.10/site-packages/docutils/nodes.py", line 2040, in unknown_departure
raise NotImplementedError(
NotImplementedError: <class 'sphinx.writers.html5.HTML5Translator'> departing unknown node type: pending_xref
I expect it might just be my lack of correct terminology limited my search result - but any help/pointers would be greatly appreciated.
More detail:
The error is being emitted because the process_todo_nodes
method is being attached to doctree-resolved
.
app.connect('doctree-resolved', process_todo_nodes)
At this point I do not think there is a state which can be passed to nested_parser(...)
to resolve the reference node.
Removing the above line runs without error.