Closed mboll closed 7 months ago
The todo
admonition is overridden by this theme in its custom admonitions ext. You can disable this behavior in conf.py.
The above advice should not be needed if you're following the tutorial correctly. The error shows that the node visitor cannot find a todo_node
docutils node and that the todo_node
isn't registered with app.add_node()
. In fact, looking at the tutorial, the name of the node (class inheriting the docutils admonition) is todo
(not todo_node
). So, I think you have an error in your extension's source.
The
NotImplementedError
is issued bydocutils
, though the custom directive works as expected when not using the immaterial theme.
I didn't see this at first. I need to see the source that you're using because the error is very specific to your undisclosed source code. Also, it would help to have a full traceback (obtained by using sphinx-build -v
).
I was able to reproduce this with a direct copy from the tutorial. I was also able to fix this by renaming the todo
class to todo_node
(as it is in the actual sphinx.ext.todo
src). It would seem that the tutorial needs updating.
disabling the overridden todo admonition with
sphinx_immaterial_override_builtin_admonitions = False
seems to build without error. So, the custom_admonitions.py cannot account for third-party variants of the todo
extension. As this was a foreseen problem (why disabling the overrides is allowed), I don't think it needs to be addressed as it is specific to the todo
admonition and not specific to custom docutils
nodes.
Thanks Brendan. I'm glad you were able to reproduce; I had just been compiling an example.
It sounds like this isn't an issue specifically related to the immaterial theme? I'll create an item for the sphinx issue tracker.
Out of curiosity, is the reason that this works without the immaterial theme related to the overwritten admonitions?
Agh, sorry. Miss-clicked the close button.
we posted at the same time 🤣 See my previous comment.
It would be beneficial (for this theme) to update the sphinx tutotial, but I don't think there is anything else that should be done on their end.
Note I also had to rename a local variable in the
TodoDirective.run()
to avoid naming conflicts.
I'm not sure if this is the correct title, or frankly what the problem is exactly, but it seems the theme doesn't support custom docutils nodes.
This should be reproduceable by following the sphinx tutorial for developing a custom extension. When I do that, then insert the new
.. todo::
directive in a page and build the docs, I get the error below.The
todo_node
is generated in the sphinx tutorial. TheNotImplementedError
is issued bydocutils
, though the custom directive works as expected when not using the immaterial theme.I received this error with sphinx versions
6.2.1
and7.2.6
. Usingsphinx-immaterial==0.11.7
.