Lii
Lii

Reputation: 12112

Linking to a specific section in package-info.java

How can I link to a specific section in a package-info.java file from Javadoc in other places?

The section could specified with a <a name="section-name">... tag, then the produced link should have a ... /package-summary.html#section-name URL. But other ways of specifying sections are also interesting.

Requirements:

  1. It must be possible to link from packages other than the one documented with package-info.java file.

  2. URLs relative to the link source (like ..\..\p1\p2\package-info.java) can not be used, since they would be so hard to maintain.

  3. The link should (preferable) be understood not only by a web browser but also by IDEs (most importantly Eclipse) in their auto-generated, pop-up rendering of Javadoc.

    I think the only way to achieve this would be to not use href and instead use{@linkplain}, but I can't figure about how to specify a section.

Upvotes: 0

Views: 57

Answers (1)

Lii
Lii

Reputation: 12112

It is possible to do this with a href and the @{docRoot} tag:

<a href="{@docRoot}/p1/p2/package-summary.html#section-name">Section Name</a>

This doesn't fulfil requirement 3 though, since in Eclipse following such a link opens a web browser instead of the build in Javadoc viewer. So if anyone finds another solution I'd be grateful.

Upvotes: 1

Related Questions