useblocks / sphinx-needs

Adds needs/requirements to sphinx
https://sphinx-needs.readthedocs.io/en/latest/index.html
MIT License
209 stars 66 forks source link

Graphviz needflow links are broken #1279

Open Rubyfi opened 3 weeks ago

Rubyfi commented 3 weeks ago

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 commented 3 weeks ago

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".

chrisjsewell commented 3 weeks ago

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 🤔

Rubyfi commented 3 weeks ago

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...

chrisjsewell commented 3 weeks ago

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

Rubyfi commented 2 weeks ago

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.