Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Web links in generated images, e.g using image maps?

+1 vote
Is it (or can it be in anear future) possible to include hyper text links in actor names, class names, signals etc and generate a corresponding image map with the graphics so as to enable creation of a fully linked, web based documentation? This would greatly improve the possibility to navigate a web published docuemntation using PlantUML generated graphics.
asked Dec 6, 2012 in Wanted features by anonymous

1 Answer

+1 vote

This is not documented yet, but this is already possible.

We will write some pages about this, but you can use the following working example to get the syntax:

@startuml
participant Bob [[http://www.yahoo.com]]
Bob -> Alice : [[http://www.google.com]] hello
@enduml


@startuml
class Dummy [[http://www.yahoo.com]]
Object <|-- Foo
class Foo {
  [[http://www.google.com]]
  + methods1() [[http://www.yahoo.com/A1{Some explainations about this method}]]
  + methods2() [[http://www.yahoo.com/A2]]
}
 
class Foo2 {
  + methods1() [[http://www.yahoo.com/B1]]
  + methods2() [[http://www.yahoo.com/B2]]
}
 
class Object {
  [[http://www.yahoo.com]]
}
@enduml



@startuml
:Foo:
note left of Foo {
[[http://www.google.com]]
This is a note
}

note right of Foo {
Yet another link to [[http://www.google.com]] as demo.
You can also <u>[[http://www.yahoo.fr specify a text]]</u> for the link.
And even <u>[[http://www.yahoo.fr{This is a tooltip} add a tooltip]]</u> to the link.
}

@enduml



@startuml
Dummy -> Alice : foo1
ref over Alice, Dummy : [[http://www.google.com]] Foo2

Alice -> Bob : hello

ref over Alice, Bob
  [[http://www.google.com]]
  this is a
  reference over
  Alice and Bob
end

@enduml



 

answered Dec 6, 2012 by plantuml (40,040 points)
Hyperlink in component diagram
I tried to add links on a class and on attributes like this:

class Foo2 [[http://www.yahoo.com/Foo2]] {
  +double x [[http://www.yahoo.com/B1]]
  +double y [[http://www.yahoo.com/B2]]
}

Based on this source plantuml generates SVGs with nested html hyperlinks (B1 and B2 nested within Foo2) which is not allowed by the HTML spec.

Another problem arises if an attribute contains the suffix "[]" for an array:

class Foo2 [[http://www.yahoo.com/Foo2]] {
  +double[] x [[http://www.yahoo.com/B1]]
  +double y [[http://www.yahoo.com/B2]]
}

In this case the hyperlink is created after the attribute and the hyperlink itself appears in the resulting SVG.
Thanks for the report about [] for an array : this should have been fixed in V8015.

About nested html hyperlinks, did you have any pointer to HTML spec that does not allowed it ? It's hard to find a work around about it.

Thanks again
Thanks for your quick answer! I'll try the V8015 to fix the problem with the array problem.
About nested html links I found this discussion on stackoverflow: http://stackoverflow.com/questions/9882916/are-you-allowed-to-nest-a-link-inside-of-a-link
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...