You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19,69 +19,83 @@ and is always contribution-ready.
19
19
20
20
Currently, the _types_ of documentation supported in this repository are:
21
21
22
-
-**Guides/Overviews**: Definitive guides/overviews of specific language features. Often long, detailed documents,
23
-
often produced by members of the Scala team. An example is the excellent [Collections][collections-overview] overview.
22
+
-**Guides/Overviews/Books**: Definitive guides/overviews of specific language features. Often long, detailed documents,
23
+
often produced by members of the Scala team. An example is the [Collections][collections-overview] overview.
24
+
-**References**: The canonical reference for language features, written by members of the Scala team.
25
+
These provide the exact specification to understand more subtle aspects of the language. An example is the
26
+
[Scala 3 reference][scala-3-reference].
24
27
-**Tutorials**: Bite-size, example-rich, and concise articles meant to get a developer up to speed quickly.
25
28
-**Cheatsheets**: Quick reference of Scala syntax and behaviors.
26
29
27
30
### Implementation
28
31
29
32
The website is statically generated from [Markdown](https://en.wikipedia.org/wiki/Markdown) source using
30
33
[Jekyll](https://github.com/mojombo/jekyll), and hosted on [GitHub Pages](https://pages.github.com/).
31
-
This workflow was chosen so as to make it as easy as possible for core committers and the community alike
32
-
to produce HTML documentation, and as easy as possible to publish it in a central location.
34
+
This workflow was chosen to help contributors to focus on writing helpful content, rather than on configuration and
35
+
boilerplate. It also aids publishing a static site in a central location.
33
36
34
37
The markdown syntax being used supports [Maruku](https://github.com/bhollis/maruku) extensions, and has automatic
35
38
syntax highlighting, without the need for any tags.
36
39
37
40
Additionally [mdoc](https://github.com/scalameta/mdoc) is used during pull requests to validate Scala code blocks.
38
-
To use this feature you must use the backtick notation as documented by mdoc. Note that only validation is done.
39
-
The output files from mdoc are not used in the building of the tutorial. Use `mdoc` or `mdoc:fail` for your code blocks.
41
+
To use this feature you must use the backtick notation as documented by mdoc,
42
+
[see here](#code-blocks) for an example.
43
+
44
+
**Note:** only validation of code is done by mdoc, and no extra output is generated.
40
45
41
46
## Submitting Docs
42
47
43
-
For one to contribute a document, one must simply
48
+
For you to contribute a document, first
44
49
[fork](https://help.github.com/articles/fork-a-repo/) the
45
-
[repo](https://github.com/scala/docs.scala-lang), write their article in
46
-
[Markdown](https://daringfireball.net/projects/markdown/syntax) (example below), and submit a pull request. That's it.
50
+
[repo](https://github.com/scala/docs.scala-lang), then write your article in
51
+
[Markdown](https://daringfireball.net/projects/markdown/syntax) (example below), and finally submit a pull request.
47
52
Likely after some edits and discussion, your document will be made live
48
53
on [docs.scala-lang.org][home].
49
54
50
55
---
51
-
layout: overview
56
+
layout: singlepage-overview
52
57
title: My Awesome Title
53
58
---
54
59
55
60
## An h2 Header in Markdown
56
61
57
62
And a paragraph, with a [link](https://www.scala-lang.org).
58
63
59
-
One can contribute code in a markdown document by either
60
-
- indenting it by 4 spaces
61
-
- surrounding by triple backticks, as shown below
62
-
- in-line by putting backticks around it, e.g. `def foo`.
64
+
You can contribute code in a markdown document by either
65
+
- in-line by putting backticks around it,
66
+
- surrounding by triple backticks,
67
+
- or indenting it by 4 spaces, e.g.:
68
+
69
+
~~~
70
+
inline example: `val x = 23`
71
+
72
+
block example:
73
+
```scala
74
+
println("hello")
75
+
```
76
+
77
+
indented example:
63
78
64
-
```scala
65
-
println("hello")
66
-
```
79
+
case class Foo(x: Int)
80
+
~~~
67
81
68
-
Everything else is automatically generated for you; tables of contents, and most index pages. And of course, the
69
-
styling is already taken care of for you.
82
+
Tables of contents will be automatically generated in a sidebar for your document, and syntax highlighting
83
+
is provided.
70
84
71
85
### Criteria for Docs to be Accepted
72
86
73
-
The goal of this documentation repository is to be tighter and more organized than other community-driven documentation platforms, like wikis. As such, any document pulled in for inclusion on
74
-
[docs.scala-lang.org][home] must:
87
+
The goal of this documentation repository is to be highly curated, rather than the approach by other community-driven
88
+
documentation platforms, like wikis. Therefore, to be included on [docs.scala-lang.org][home], a document must:
75
89
76
90
-**"fit in"** to the repository ( _i.e.,_ it should not be a complete duplicate of another article),
77
-
-**be polished**it must be thorough, complete, correct, organized, and "article-like" (personal programming notes
78
-
don't quite fit.)
79
-
-**be maintained** if the document might require revisions from time to time, be prepared to keep it up to date, or
91
+
-**be polished**, i.e. it must be thorough, complete, correct, and organized; written as an article to be understood
92
+
by many users.
93
+
-**be maintained**, if the document might require revisions from time to time, be prepared to keep it up to date, or
80
94
nominate someone to take ownership.
81
95
82
96
If you have something you're thinking about contributing, or that you're thinking about writing in order to contribute
83
97
-- we'd love to consider it! Please don't hesitate to use GitHub issues and pull requests and the
84
-
\#scala-contributors room [on Discord](https://discord.com/invite/scala) for any questions, concerns,
98
+
`#scala-contributors` room [on Discord](https://discord.com/invite/scala) for any questions, concerns,
85
99
clarifications, etc.
86
100
87
101
## Document Templates
@@ -90,38 +104,36 @@ clarifications, etc.
90
104
91
105
### Guides/Overviews
92
106
93
-
A guide or an overview that can be logically placed on **one** page must be placed in the directory
94
-
`_overviews/RELEVANT-CATEGORY/_posts` with the file name in the format `YYYY-MM-dd-title-separated-by-dashes.md`,
95
-
and header:
107
+
A guide or an overview that can be logically placed on **one** markdown page should be placed in the directory
108
+
`_overviews/RELEVANT-CATEGORY/`. It should have the header:
96
109
97
110
---
98
-
layout: overview
111
+
layout: singlepage-overview
99
112
title: YOUR TITLE
100
113
---
101
114
102
-
The rest of the document should, of course, be written in [Markdown](https://en.wikipedia.org/wiki/Markdown).
115
+
The rest of the document will be written in [Markdown](https://en.wikipedia.org/wiki/Markdown) syntax.
103
116
104
-
At the moment, `RELEVANT-CATEGORY` corresponds to only a single category, "core," because we are currently focusing on
105
-
building up documentation of core libraries. However, expect more categories here in the future.
117
+
You may substitute `RELEVANT-CATEGORY` for any directory that is related, or create a new one if one is not suitable.
106
118
107
-
If your document consists of **multiple** pages, like the [Collections][collections-overview] overview, an ordering
108
-
must be specified, by numbering documents in their logical order with `num`, and a name must be assigned to the
109
-
collection of pages using `partof`. For example, the following header might be used for a document in the collections
110
-
overview:
119
+
If your guide/overview consists of **multiple** pages, like the [Collections][collections-overview] overview,
120
+
an ordering must be specified, by numbering documents in their logical order with the `num` tag in the header,
121
+
and a name must be assigned to the collection of pages using the `partof` tag.
122
+
For example, the following header might be used for a document in the collections overview:
111
123
112
124
---
113
-
layout: overview
125
+
layout: multipage-overview
114
126
title: YOUR TITLE
115
127
116
128
partof: collections
117
129
num: 10
118
130
---
119
131
120
-
A **single** document in the collection must contain a tag in the header, `outof`, that indicates the total number of
121
-
documents in the large overview. Putting it on the last page in the overview is often best:
132
+
**At least one** document in the collection must contain a tag in the header, `outof`, that indicates the total number
133
+
of documents in the large overview. Putting it on the last page in the overview is often best:
122
134
123
135
---
124
-
layout: overview
136
+
layout: multipage-overview
125
137
title: YOUR TITLE
126
138
127
139
partof: collections
@@ -130,61 +142,90 @@ documents in the large overview. Putting it on the last page in the overview is
130
142
---
131
143
132
144
Index pages, such as [docs.scala-lang.org/overviews/index.html][overviews-index] are
133
-
generated, by reading data from a configuration file, such as `_data/overviews.yml`, so your overview should be
145
+
generated by reading data from a configuration file, such as `_data/overviews.yml`, so your overview should be
134
146
placed into a category there.
135
147
136
148
### Tutorials
137
149
138
-
At the moment, tutorials are written the same as Guides/Overviews, except that their link must be added to
139
-
the metadata of `/tutorials.md`. e.g. for the [Scala With Maven][scala-with-maven] tutorial, the
140
-
metadata of `/tutorials.md` looks like
150
+
Tutorials are different to guides, they should be written in a much more concise, task-oriented style,
151
+
usually on a single page.
152
+
153
+
Similar to guides, tutorials also use the same markdown header.
154
+
155
+
Once the tutorial is written, to aid user navigation their link must be added to
156
+
the metadata of `/tutorials.md`. e.g. it could look like
141
157
142
158
---
143
159
layout: inner-page-parent
144
160
title: Tutorials
145
161
146
162
tutorials:
147
163
...
148
-
- title: "Scala with Maven"
149
-
url: "/tutorials/scala-with-maven.html"
150
-
description: "Create a Scala project with Maven."
151
-
icon: code
164
+
- title: My New Tutorial
165
+
url: "/tutorials/my-new-tutorial.html"
166
+
description: "Learn How To Do This Specific Task"
167
+
icon: code
152
168
---
153
169
154
-
For a single-page tutorial, the typical directory to place them in is `_overviews/tutorials`.
170
+
You must also add the tutorial to the drop down list in the navigation bar. To do this, add an extra entry to
171
+
`_data/doc-nav-header.yml`. i.e.
172
+
173
+
---
174
+
- title: Getting Started
175
+
url: "/getting-started/index.html"
176
+
- title: Learn
177
+
...
178
+
- title: Tutorials
179
+
url: "#"
180
+
submenu:
181
+
...
182
+
- title: My New Tutorial
183
+
url: "/tutorials/my-new-tutorial.html"
184
+
...
185
+
---
155
186
156
187
### Cheatsheets
157
188
158
-
For now, cheatsheets are assumed to be in the form of tables. To contribute a cheatsheet, one must simply produce their
159
-
cheatsheet as a Markdown table, with the following header:
189
+
Cheatsheets have a special layout, and the content is expected to be a markdown table. To contribute a cheatsheet,
190
+
you should use the following format:
160
191
161
192
---
162
193
layout: cheatsheet
163
194
title: YOUR TITLE
164
195
by: YOUR NAME
165
196
about: SOME TEXT ABOUT THE CHEAT SHEET.
166
197
---
198
+
| Title A | Title B |
199
+
|---------|---------|
200
+
| content | more |
167
201
168
202
### Code blocks
169
203
170
204
The site build process uses [mdoc](https://scalameta.org/mdoc/) to typecheck
171
205
code snippets in markdown. This is a great way to ensure the code snippets that
172
-
you're including typecheck and are valid. Here are a few quick types to get
173
-
started.
206
+
you're including typecheck and are valid. Here are a few quick tips to get
207
+
started:
174
208
175
-
To get started, add `mdoc` after `scala` when you are creating a
209
+
First, add `mdoc` after `scala` when you are creating a
176
210
code block. The `mdoc` modifier here will make sure that `mdoc` runs the code
<spanclass="hljs-keyword">case</span> <spanclass="hljs-class"><spanclass="hljs-keyword">class</span> <spanclass="hljs-title">Foo</span>(<spanclass="hljs-params">a: <spanclass="hljs-type">Int</span></span>) <spanclass="hljs-comment">// conflicts with Foo above, but it's nested so it's fine</span></span>
<span class="hljs-keyword">val</span> a = <span class="hljs-string">s"The time is <span class="hljs-subst">${now()}</span>"</span> <span class="hljs-comment">// still have access to the now method from above</span>
252
+
```
253
+
</code></pre></div></div>
202
254
203
-
```scala mdoc:nest
204
-
case class Foo(a: Int) // conflicts with Foo above, but it's nested so it's fine
<span class="hljs-keyword">val</span> myFoo = <span class="hljs-type">Foo</span>(<span class="hljs-string">"hi"</span>) <span class="hljs-comment">// now we only have access to the last Foo</span>
262
+
```
263
+
</code></pre></div></div>
216
264
217
265
[collections-overview]: {% link _overviews/collections-2.13/introduction.md %}
218
-
[scala-with-maven]: {% link _overviews/tutorials/scala-with-maven.md %}
0 commit comments