Hyperlinks in PlantUML diagram on Gitlab not working, presented as a png graphic

0 votes
asked Apr 22, 2025 in Question / help by arcomber (160 points)
These are the steps I have used to reach this problem.

Create this test plantuml file:

```
@startuml
actor User
rectangle "web" {
  usecase uc01 as "Use Case 1 - Start
  ----
  [[https://www.google.co.uk/ Details]]
  "
  usecase uc02 as "Use Case 2 - Stop
  ----
  [[https://plantuml.com/ Details]]
  "
  User --> uc01
  User --> uc02
}
@enduml
```

Then run command:
java -jar /home/user/Documents/misc/plantuml.jar basic-hyperlink-test.txt

which generates a png file which renders the hyperlinks as you would expect but if you click on the png file in an image editor of course nothing happens.

This other file is also generated, basic-hyperlink-test.cmapx:
```
<map id="basic-hyperlink-test_map" name="basic-hyperlink-test_map">
<area shape="rect" id="id1" href="https://plantuml.com/" title="https://plantuml.com/" alt="" coords="89,170,137,186"/>
<area shape="rect" id="id2" href="https://www.google.co.uk/" title="https://www.google.co.uk/" alt="" coords="305,170,354,186"/>
</map>
```
If I now go to the PlantUML web server and enter the above plantuml source, there are three hyperlinks I can click on : PNG, SVG and ASCII Art.  If I click on PNG I get a png file, but if I select SVG, then I am presented with a diagram where I can click on Details hyperlink and links work.

I need to display this diagram on my Gitlab wiki, so I create a document named basic-hyperlink-test.md like this:

    # Basic Hyperlink Test

    ```plantuml
    @startuml
    actor User
    rectangle "web" {
      usecase uc01 as "Use Case 1 - Start
      ----
      [[https://www.google.co.uk/ Details]]
      "
      usecase uc02 as "Use Case 2 - Stop
      ----
      [[https://plantuml.com/ Details]]
      "
      User --> uc01
      User --> uc02
    }
    @enduml
    ```

push that, then when I view the file in the repository tree I click on the file, it presents the diagram as expected but when I click on the Details hyperlink it just enlarges the png image - and the link doesn't take me to the hyperlink target.

I am using Google Chrome Version 135.0.7049.85 (Official Build) (64-bit). Also get exactly the same behaviour with latest version Microsoft Edge. The version of PlantUML server is 1.2025.2.

How can I fix this so that hyperlinks in the diagram click through to the target?

1 Answer

+1 vote
answered Apr 22, 2025 by Serge Wenger Work (16,630 points)
selected Apr 22, 2025 by arcomber
 
Best answer
Hello,

It works only with svg.
commented Apr 22, 2025 by arcomber (160 points)
If I click on a link in the diagram, the link navigates to:

myserver/-/plantuml/png/<somehash>

So it seems the png version is being generated from gitlab.  How can I configure to produce svg?
commented Apr 22, 2025 by Serge Wenger Work (16,630 points)

I don't know, because I didn't use Gitlab, but you must link to 
myserver/-/plantuml/svg/<somehash>

commented Apr 22, 2025 by arcomber (160 points)
Hmmm this may be a web server/Gitlab issue because it seems that I can manually open the url myserver/-/plantuml/svg/<somehash> - then I get the svg and the links work.  I will tick your answer and try to find out how to fix with web server/gitlab
...