0

How to make a link to some imported name (which is in another package) in scaladoc, whithout having to use fully qualified name?

Example:

file 1

package com.pany.pck1.subpck
class Class1

file 2

package com.pany.pck2.othersubpck
import com.pany.pck1.subpck.Class1

/**
 * Use a [[Class1]]
 */
case class Class2(c1: Class1)

But I don't want to have in the doc [[com.pany.pck1.subpck.Class1]].

If necessary, I would not mind having a ref at the end of the Class2 doc, such as

/**
 * ...
 * [Class1= com.pany.pck1.subpck.Class1]
 */
Juh_
  • 14,628
  • 8
  • 59
  • 92

1 Answers1

1

I found a way, using @define:

file 1

package com.pany.pck1.subpck
class Class1

file 2

package com.pany.pck2.othersubpck
import com.pany.pck1.subpck.Class1

/**
 * Use a $Class1
 *
 * @define Class1 [[com.pany.pck1.subpck.Class1 Class1]]
 */
case class Class2(c1: Class1)

So basically, define is used to create a Macro Class1, which is replaced by the link [[com.pany.pck1.subpck.Class1 Class1]]: a link to com.pany.pck1.subpck.Class1 that is displayed as Class1.

This is quite convoluted but it answers the requirement.

Juh_
  • 14,628
  • 8
  • 59
  • 92