Skip to content

Scaladoc reports broken links that aren't broken #16695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alanbur opened this issue Jan 14, 2023 · 3 comments · Fixed by #17099
Closed

Scaladoc reports broken links that aren't broken #16695

alanbur opened this issue Jan 14, 2023 · 3 comments · Fixed by #17099

Comments

@alanbur
Copy link

alanbur commented Jan 14, 2023

Scaladoc version 3.2.1 -- Copyright 2002-2022, LAMP/EPFL

If a relative link is put in to a static doc which references the generated docs, it is incorrectly reported as broken. The link in the output works fine however.

[SomeClass](../foo/bar/SomeClass.html)

[warn] -- Warning: static_site/_docs/index.md -----------------------------------------
[warn] /home/foo/static_site/_docs/index.md: Unable to resolve link '../foo/bar/SomeClass.html

What's really needed is a proper way of referencing the generated class documentation from static doc files without including the entire class path, e.g. [[SomeClass]] rather than [[foo.bar.SomeClass]]. In fact the support for [[ ... ]]] references in static docs seems mostly broken,

@alanbur alanbur added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 14, 2023
@alanbur
Copy link
Author

alanbur commented Jan 14, 2023

Thinking about it some more, perhaps the front matter directives should be extended to include import statements?

Also, full support for [[ ... ]] links that are compatible with doc comments in source files should be implemented, for example [[SomeClass descriptive text]] should work and currently doesn't.

@KacperFKorban KacperFKorban added area:doctool and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 14, 2023
@ckipp01
Copy link
Member

ckipp01 commented Mar 15, 2023

Hey @Dedelweiss I saw you opened a PR about this, but I figured it might be a good idea to discuss here a bit first because I have a few question that might help with the context for review.

What's really needed is a proper way of referencing the generated class documentation from static doc files without including the entire class path, e.g. [[SomeClass]] rather than [[foo.bar.SomeClass]].

Wouldn't we want to include the full classpath though? For example what happens in we have both a foo.bar.SomeClass and also a foo.baz.SomeClass? The only way to really differentiate them would be to include the fully qualified name. I think having SomeClass by itself here may cause a bit of confusion.

In fact the support for [[ ... ]]] references in static docs seems mostly broken,

Just to be clear, we're talking about [[...]] in the context of markdown leading to the api docs right? We're not talking about scaladocs that include [[...]]? If the the former, where is the feature even documented, I had no idea you could even do that.

@julienrf
Copy link
Contributor

I agree that we should include the full classpath. I think it is fine to require a fully qualified name in static pages, but we may consider introducing a setting to set a package prefix if there is a high demand for it.

ckipp01 pushed a commit that referenced this issue Jun 9, 2023
In this PR: 
I change the regular path from `../exception/scala/Foo.html` to
`exception.scala.Foo` to use the DRI resolver function.

## Context:

I have a Hello World project with a `Foo` class and a `Foo2` object
within a package `exception.scala`
<img width="225" alt="Screenshot 2023-06-07 at 12 45 47"
src="https://github.com/lampepfl/dotty/assets/44496264/1d155f81-5910-44b4-be0c-b495cd75e597">


### Example 1 (No warning):

<img width="500" alt="Screenshot 2023-06-07 at 15 38 07"
src="https://github.com/lampepfl/dotty/assets/44496264/cf341967-8743-480a-9f35-7c27ed78a691">

### Result:

<img width="800" alt="Screenshot 2023-06-07 at 12 50 13"
src="https://github.com/lampepfl/dotty/assets/44496264/ccea1646-3501-4ad2-b9d0-ee5d8bbac969">
As you can see, as expected there is no warning for these links.

### Example 2 (Warnings):

<img width="500" alt="Screenshot 2023-06-07 at 15 41 00"
src="https://github.com/lampepfl/dotty/assets/44496264/9309a851-24d6-472e-839e-444c0dc58bb6">

### Result:

<img width="800" alt="Screenshot 2023-06-07 at 15 41 13"
src="https://github.com/lampepfl/dotty/assets/44496264/1b8986f9-d06c-4eda-9599-e4f2cc0343f7">

Fixes: #16695
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 2, 2023
Kordyjan pushed a commit that referenced this issue Nov 17, 2023
In this PR: 
I change the regular path from `../exception/scala/Foo.html` to
`exception.scala.Foo` to use the DRI resolver function.

## Context:

I have a Hello World project with a `Foo` class and a `Foo2` object
within a package `exception.scala`
<img width="225" alt="Screenshot 2023-06-07 at 12 45 47"
src="https://github.com/lampepfl/dotty/assets/44496264/1d155f81-5910-44b4-be0c-b495cd75e597">


### Example 1 (No warning):

<img width="500" alt="Screenshot 2023-06-07 at 15 38 07"
src="https://github.com/lampepfl/dotty/assets/44496264/cf341967-8743-480a-9f35-7c27ed78a691">

### Result:

<img width="800" alt="Screenshot 2023-06-07 at 12 50 13"
src="https://github.com/lampepfl/dotty/assets/44496264/ccea1646-3501-4ad2-b9d0-ee5d8bbac969">
As you can see, as expected there is no warning for these links.

### Example 2 (Warnings):

<img width="500" alt="Screenshot 2023-06-07 at 15 41 00"
src="https://github.com/lampepfl/dotty/assets/44496264/9309a851-24d6-472e-839e-444c0dc58bb6">

### Result:

<img width="800" alt="Screenshot 2023-06-07 at 15 41 13"
src="https://github.com/lampepfl/dotty/assets/44496264/1b8986f9-d06c-4eda-9599-e4f2cc0343f7">

Fixes: #16695
[Cherry-picked 2d9eb1c]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants