Closed arwedus closed 9 months ago
I assume that the function get_node_depth(node: Node)
is problematic.
If it gets an invalid document (where a section node has no parent), it causes the exception.
I extended the function to see which document is the culprit.
I thereby learned that the problem occurs when including a myst-markdown document into a restructuredtext document (I am not resposible for people doing that stuff :D). I'll try to compile an example.
@chrisjsewell : Maybe you know, as Myst-markdown developer, what the root cause could be?
NOTE: We have several such includes of markdown snippets parsed by mystparser.sphinx in rst documents, and only two of them fail. I have not yet been able to find out why such an import fails sometimes and works the other times.
Can you remove them and check whether the error still occurs? I think it's probably related to myst
rather than Sphinx itself, so for now I'll close it (and you should instead ask this on myst
).
Feel free to reopen it if you can make it without additional extensions or if Chris sends you back here (but I prefer not having too many opened issues that may not be directly concern the code base).
Describe the bug
When building documentation with the following configuration:
I get the following output:
This happens independent of the autosectionlabel_maxdepth value.
When I remove the autosectionlabel_maxdepth configuration, the extension error disappears.
Build command:
How to Reproduce
This happens in a closed source project, which has a very large number of documents, many of them contain duplicate section labels, and sections down to level 5, so I can't provide a link here.
The error occurs for rst documents that contain an include directive including MyST markdown, e.g.:
The only use case I see for that is including common text blocks that have been written in markdown into a larger rst document.
NOTE: We have several such includes of markdown snippets parsed by mystparser.sphinx in rst documents, and only two of them fail. I have not yet been able to find out why such an import fails sometimes and works the other times.
Environment Information
Sphinx extensions
Additional context
No response