Skip to content

Commit 56ecffc

Browse files
committed
Update scaladoc docs
1 parent fcd837a commit 56ecffc

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Multiple versions changing
3+
---
4+
5+
# {{ page.title }}
6+
7+
Scaladoc now provides convenient way to link between different versions of documentation. The feature is pretty handy if we want to expose older docs for users that didn't migrate to the new version of our library.
8+
9+
### How to setup it
10+
11+
The feature was designed for easy scalability with no need to regenerate all scaladocs after adding next version. Becuase of that we decided to introduce the new setting passed during creation of scaladoc `-versions-dictionary-url` pointing with URL to JSON document holding information about locations of specific versions. The JSON file has single property "versions" that holds dictionary of labels of specific docs and URL pointing to their index.html top-level file.
12+
13+
Example JSON file:
14+
```
15+
{
16+
"versions": {
17+
"3.0.X": "https://dotty.epfl.ch/3.0.X/docs/index.html",
18+
"Nightly": "https://dotty.epfl.ch/docs/index.html"
19+
}
20+
}
21+
```
22+
23+
This enforce us to provide the setting while genereting docs for each of the versions, however it gives us more flexebility later. Consider one want to add next version of the API docs along previous 5 versions he/she has already published. The only thing is to upload them to some web server host and update the JSON file with another entry. All scaladocs will now become aware of the new scaladoc version.
24+
25+
### How does it look from user perspective
26+
27+
Providing JSON file via `-versions-dictionary-url` enables scaladoc to link between versions. We found it convenient to change the revision label into drop-down menu that let you change between different version. Everything will change automatically, no need for further setup.
28+
29+
![](../../../images/scaladoc/nightly.gif)

docs/docs/usage/scaladoc/settings.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,19 @@ A base URL to use as prefix and add `canonical` URLs to all pages. The canonical
117117
##### -siteroot
118118

119119
A directory containing static files from which to generate documentation. Default directory is `./docs`
120+
121+
##### -versions-dictionary-url
122+
123+
A URL pointing to a JSON document containing a dictionary version -> documentation location.
124+
The JSON file has single property "versions" that holds dictionary of labels of specific docs and URL pointing to their index.html top-level file.
125+
Useful for libraries that maintain different releases docs.
126+
127+
Example JSON file:
128+
```
129+
{
130+
"versions": {
131+
"3.0.X": "https://dotty.epfl.ch/3.0.X/docs/index.html",
132+
"Nightly": "https://dotty.epfl.ch/docs/index.html"
133+
}
134+
}
135+
```

docs/images/scaladoc/nightly.gif

70.1 KB
Loading

scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings:
9696
val versionsDictionaryUrl: Setting[String] = StringSetting(
9797
"-versions-dictionary-url",
9898
"versions dictionary url",
99-
"A URL pointing to a JSON document containing a dictionary version -> documentation location. Useful for libraries that maintain different releases docs",
99+
"A URL pointing to a JSON document containing a dictionary version -> documentation location. " +
100+
"The JSON file has single property \"versions\" that holds dictionary of labels of specific docs and URL pointing to their index.html top-level file. " +
101+
"Useful for libraries that maintain different releases docs.",
100102
""
101103
)
102104

0 commit comments

Comments
 (0)