add svg_link_prefix option to inheritance_diagram #6454
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subject: Add an option to set the prefix for links in SVG inheritance diagrams
Feature or Bugfix
Purpose
Detail
As discussed in astropy/astropy#4935 and #2484, the inheritance diagram machinery currently yields broken links as we implemented it in sphinx-automodapi and astropy. You can see an example here: https://docs.astropy.org/en/v3.1.2/coordinates/index.html#class-inheritance-diagram . The gist of the problem (as discussed in #2484) is that we embed the SVG in the page. This means the path to the actual class pages don't have the
'..'
that apparently gets created when embedding as a separate file. (FWIW, the links originally worked when we first did this, but then the changes in #967 ended up breaking it. And here we are years later with me finally having realized the underlying cause!).So this PR introduces a new config option in inheritance_diagram that sets the prefix. The default is still
../
, so it shouldn't break other code, but it will then be possible to supress the..
in cases like ours where it's breaking the links. I think it may partly address #3176 by giving that use case the flexibility to pick their own prefix as well (although I'm not 100% sure about that one).Relates