Skip to content

Fix relative references in SVGs generated by sphinx.ext.graphviz#11078

Merged
AA-Turner merged 8 commits intosphinx-doc:masterfrom
Panaetius:fix-graphviz-include-paths
Jul 28, 2023
Merged

Fix relative references in SVGs generated by sphinx.ext.graphviz#11078
AA-Turner merged 8 commits intosphinx-doc:masterfrom
Panaetius:fix-graphviz-include-paths

Conversation

@Panaetius
Copy link
Contributor

closes #11077

@grahamwaters
Copy link

could this help?
https://github.com/grahamwaters/ReferenceMedic

@Panaetius
Copy link
Contributor Author

Panaetius commented Jan 23, 2023

could this help? https://github.com/grahamwaters/ReferenceMedic

I don't think it does. It doesn't support svg files at the moment. And it seems to just fix paths for a very specific folder layout, whereas in this case we know exactly from which source document to which target folder relative reference need to be changed in sphinx, and what type of attributes can be affected, so searching svg (XML) with a regex sounds like a bad idea when we can instead specifically look for e.g. href attributes to update and not accidentally update something that's not relevant. Especially since ONLY links/references need to be updated, paths in plain text do no need to be changed.
Also that library only deals with file paths, but we need to fix URLs in general (Like #my-anchor needs to be changed to ../mydoc/subdoc/#my-anchor). The targets can be anywhere in the file structure, essentially, depending on where the source *.rst file was, not in a fixed directory structure.

@AA-Turner AA-Turner added this to the some future version milestone Apr 29, 2023
@AA-Turner AA-Turner changed the title Fix relative references in graphviz svg Fix relative references in SVGs generated by sphinx.ext.graphviz Jul 28, 2023
@AA-Turner AA-Turner merged commit 6178163 into sphinx-doc:master Jul 28, 2023
@AA-Turner
Copy link
Member

Thanks @Panaetius!

A

@AA-Turner AA-Turner modified the milestones: some future version, 7.2.0 Aug 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2023
@AA-Turner AA-Turner added the extensions:graphviz The `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensions label Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

extensions:graphviz The `sphinx.ext.graphviz` or `sphinx.ext.inheritance_diagram` extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative references in graphviz svgs have the wrong root

4 participants