Skip to content

Commit 4a3a193

Browse files
authored
Merge branch 'scala:main' into _overview/scala3-book/num8-code-tabs
2 parents 4c9c12b + 90b0971 commit 4a3a193

22 files changed

+1581
-413
lines changed

_overviews/collections-2.13/trait-iterable.md

Lines changed: 86 additions & 87 deletions
Large diffs are not rendered by default.

_overviews/contribute/add-guides.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ can generate the same tabs in markdown with the `tabs` directive and class `tabs
111111
~~~liquid
112112
{% tabs hello-world-demo class=tabs-scala-version %}
113113
114-
{% tab 'Scala 2' for=hello-world-demo %}
114+
{% tab 'Scala 2' %}
115115
```scala
116116
object hello extends App {
117117
println("Hello, World!")
118118
}
119119
```
120120
{% endtab %}
121121
122-
{% tab 'Scala 3' for=hello-world-demo %}
122+
{% tab 'Scala 3' %}
123123
```scala
124124
@main def hello() = println("Hello, World!")
125125
```
@@ -134,12 +134,12 @@ It is crucial that you use the `tabs-scala-version` class to benefit from some c
134134
- the tab picked will be remembered across the site, and when the user returns to the page after some time.
135135

136136
For code snippets that are valid in both Scala 2 and Scala 3, please use a single tab labelled
137-
Scala 2 and 3 (please note that the `tabs-scala-version` class is also dropped):
137+
`'Scala 2 and 3'` (please note that the `tabs-scala-version` class is also dropped):
138138

139139
<!-- {% raw %} -->
140140
~~~liquid
141141
{% tabs scala-2-and-3-demo %}
142-
{% tab 'Scala 2 and 3' for=scala-2-and-3-demo %}
142+
{% tab 'Scala 2 and 3' %}
143143
```scala
144144
List(1, 2, 3).map(x => x + 1).sum
145145
```
@@ -148,6 +148,19 @@ List(1, 2, 3).map(x => x + 1).sum
148148
~~~
149149
<!-- {% endraw %} -->
150150

151+
For examples that only apply to either one of Scala 2 or 3, use the tabs `'Scala 2 Only'` and `'Scala 3 Only'`.
152+
153+
If you have a particularly long tab, for readability you can indicate which tab group it belongs to with
154+
a parameter `for=tab-group` as in this example:
155+
<!-- {% raw %} -->
156+
~~~liquid
157+
{% tabs my-tab-group class=tabs-scala-version %}
158+
...
159+
{% tab 'Scala 3' for=my-tab-group %}
160+
...
161+
~~~
162+
<!-- {% endraw %} -->
163+
151164
### Typechecked Examples
152165

153166
The site build process uses [mdoc](https://scalameta.org/mdoc/) to typecheck

0 commit comments

Comments
 (0)