-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
extensions:graphvizThe `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensionsThe `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensions
Milestone
Description
Describe the bug
When including a graphviz graph that itself has a reference to a file by relative path (embedded image or hyperlink), the link target is wrong in the rendered docs when using svg format.
This is because the rendered graphviz file is put in the _images folder in the built documentation, irrespective of where the original documentation file was, hence any relative path (e.g.../../_stativ/image.svg) is now invalid since the root of the graph changed.
I have a PR that would fix this by rewriting relative URLs in generated SVGs
How to Reproduce
index.rst:
graphviz
========
.. graphviz::
:align: center
digraph test {
foo [label="foo", URL="#graphviz", target="_parent"]
bar [label="bar", image="./_static/images/test.svg"]
baz [label="baz", URL="./_static/images/test.svg"]
foo -> bar -> baz
}
conf.py:
extensions = ['sphinx.ext.graphviz']
exclude_patterns = ['_build']
html_static_path = ["_static"]
The rendered svg still points to e.g. ./_static/images/test.svg, even though since it's now in _images/, it should be ../_static/images/test.svg
Environment Information
Platform: linux; (Linux-6.1.1-arch1-1-x86_64-with-glibc2.36)
Python version: 3.9.15 (main, Nov 18 2022, 14:40:14)
[GCC 12.2.0])
Python implementation: CPython
Sphinx version: 6.0.0
Docutils version: 0.19
Jinja2 version: 3.0.3
Sphinx extensions
`['sphinx.ext.graphviz']`Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
extensions:graphvizThe `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensionsThe `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensions