sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Graphviz needflow links are broken

Open Rubyfi opened this issue 1 year ago • 5 comments
trafficstars

Hi all,

I noticed that the links in needflows seem to be broken when they are generated using the new graphviz engine. See, e.g,, https://sphinx-needs.readthedocs.io/en/latest/directives/needflow.html#needflow Example 1 The need links are always based on the current page.

Furthermore, you can no longer directly click the elements (tested on Firefox and MS Edge, Chrome likely behaves the same). When you click the image, the svg is first opened separately. After that, you are able to click the objects which will result in a 404 due to the broken links.

Rubyfi avatar Sep 05 '24 11:09 Rubyfi

I've done some digging and this line seems to be the problem: https://github.com/useblocks/sphinx-needs/blob/e5e370eb6047cbd8c23b3377a806a60c33f40b9d/sphinx_needs/directives/needflow/_graphviz.py#L160 Removing the relative argument fixes the issue for me when using graphviz_output_format = "svg".

Rubyfi avatar Sep 05 '24 12:09 Rubyfi

ah yeh I see, I tested this on needs within the same page, and it was working, but apparently not for needs on different pages.

Furthermore, you can no longer directly click the elements

you could never directly click on the elements with svg, and can't do that also for plantuml. you can actually now though if you output png

as I mention at the bottom of https://github.com/useblocks/sphinx-needs/pull/1235#issue-2482268897, it seems not possible with SVG to have both transparent backgrounds and directly clickable links 🤔

chrisjsewell avatar Sep 05 '24 13:09 chrisjsewell

ah yeh I see, I tested this on needs within the same page, and it was working, but apparently not for needs on different pages.

Furthermore, you can no longer directly click the elements

you could never directly click on the elements with svg, and can't do that also for plantuml. you can actually now though if you output png

as I mention at the bottom of #1235 (comment), it seems not possible with SVG to have both transparent backgrounds and directly clickable links 🤔

Thanks for the explanation. TBH, even as an advocate for dark themes, I'd prefer clickable links over dark/transparent backgrounds.

I also did some further testing. The path/link thing seems to be dependent on the chosen output format, what a nightmare...

Rubyfi avatar Sep 05 '24 13:09 Rubyfi

You mean if you set graphviz_output_format="png" the link is different?

chrisjsewell avatar Sep 05 '24 13:09 chrisjsewell

You mean if you set graphviz_output_format="png" the link is different?

Yes, it appears to be the case. I'll see that I create a minimal example and provide it here.

Rubyfi avatar Sep 12 '24 07:09 Rubyfi