Skip to content

Commit 7ed4a53

Browse files
committed
Update the docs, change sidebar url property to page/index
1 parent 947f8a4 commit 7ed4a53

File tree

8 files changed

+311
-312
lines changed

8 files changed

+311
-312
lines changed

docs/docs/usage/scaladoc/settings.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ If you want to know what is current state of compatibility with scaladoc old fla
1313

1414
## Providing settings
1515

16-
Supply scaladoc settings as command-line arguments, e.g., `scaladoc -d output -project my-project target/scala-3.0.0-RC2/classes`. If called from sbt,
17-
update the value of `Compile / doc / scalacOptions`, e. g. `Compile / doc / scalacOptions ++= Seq("-d", "output", "-project", "my-project")`
16+
Supply scaladoc settings as command-line arguments, e.g., `scaladoc -d output -project my-project target/scala-3.0.0-RC2/classes`. If called from sbt, update the value of `Compile / doc / scalacOptions` and `Compile / doc / target` respectively, e. g.
17+
18+
```
19+
Compile / doc / target ++= Seq("-d", "output")
20+
Compile / doc / scalacOptions ++= Seq("-project", "my-project")
21+
```
1822

1923
## Overview of all available settings
2024

@@ -118,6 +122,10 @@ A base URL to use as prefix and add `canonical` URLs to all pages. The canonical
118122

119123
A directory containing static files from which to generate documentation. Default directory is `./docs`
120124

125+
##### -no-link-warnings
126+
127+
Avoid warnings for ambiguous and incorrect links in members look up. Doesn't affect warnings for incorrect links of assets etc.
128+
121129
##### -versions-dictionary-url
122130

123131
A URL pointing to a JSON document containing a dictionary: `version label -> documentation location`.
@@ -134,3 +142,28 @@ Example JSON file:
134142
}
135143
```
136144

145+
##### -snippet-compiler
146+
147+
Snippet compiler arguments provide a way to configure snippet checking.
148+
149+
This setting accept list of arguments in format:
150+
args := arg{,arg}
151+
arg := [path=]flag
152+
where path is a prefix of source paths to members to which argument should be set.
153+
154+
If path is not present, argument will be used as default.
155+
156+
Available flags:
157+
compile - Enables snippet checking.
158+
nocompile - Disables snippet checking.
159+
fail - Enables snippet checking, asserts that snippet doesn't compile.
160+
161+
You can read more about snippet compiler [here](snippetCompiler.md)
162+
163+
##### -Ysnippet-compiler-debug
164+
165+
Setting this option causes snippet compiler to print snippet as it is compiled (after wrapping).
166+
167+
##### -Ydocument-synthetic-types
168+
169+
Documents intrinsic types e. g. Any, Nothing. Setting is useful only for stdlib
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Snippet compiler
3+
---
4+
5+
# Snippet compiler - new way to validate your docs

docs/docs/usage/scaladoc/staticSite.md

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ documentation.
4040
In Scaladoc, all templates can contain YAML front-matter. The front-matter
4141
is parsed and put into the `page` variable available in templates via Liquid.
4242

43+
Example front-matter
44+
```
45+
---
46+
title: My custom title
47+
---
48+
```
49+
4350
Scaladoc uses some predefined properties to controls some aspect of page.
4451

4552
Predefined properties:
@@ -99,23 +106,44 @@ Scaladoc by default uses layout of files in `docs` directory to create table of
99106
```yaml
100107
sidebar:
101108
- title: Blog
102-
- title: Docs
103-
url: docs/index.html
104-
- title: Usage
109+
- title: My title
110+
page: my-page1.md
111+
- page: my-page2.md
112+
- page: my-page3/subsection
113+
- title: Reference
105114
subsection:
106-
- title: Dottydoc
107-
url: docs/usage/dottydoc.html
108-
- title: sbt-projects
109-
url: docs/usage/sbt-projects.html
115+
- page: my-page3.md
116+
- index: my-page4/index.md
117+
subsection:
118+
- page: my-page4/my-page4.md
119+
- title: My subsection
120+
index: my-page5/index.md
121+
subsection:
122+
- page: my-page5/my-page5.md
123+
- index: my-page6/index.md
124+
subsection:
125+
- index: my-page6/my-page6/index.md
126+
subsection:
127+
- page: my-page6/my-page6/my-page6.md
110128
```
111129
112-
The `sidebar` key is mandatory, as well as `title` for each element. The
113-
default table of contents allows you to have subsections - albeit the current
114-
depth limit is 2 however it accepts both files and directories and latter can be used to provide deeper structures.
130+
The `sidebar` key is mandatory.
131+
On each level you can have three different types of entries: `page`, `blog` or `subsection`.
132+
133+
`Page` is a leaf of the structure and accepts following attributes:
134+
- `title` \[optional\] - title of the page
135+
- `page` \[mandatory\] - path to the file that will represent the page, it can be either html of markdown file to be rendered, there is also possibility to pass the `directory` path. If so, the scaladoc will render the directory and all its content as if there were no `sidebar.yml` basing of its tree structure and index files.
136+
137+
The `page` property
115138

116-
The items must provide either `subsection` or `url` but not both at once!
117-
The only exception is `Blog` which is only a `title` and behaves differently.
118-
You can read more about blog [here](blog.md).
139+
`Subsection` accepts nested nodes, these can be either pages or subsection, which allow you to create tree-like navigation. The attributes are:
140+
- `title` \[optional\] - title of the page
141+
- `index` \[optional\] - path to the file that will represent the index file of the subsection, it can be either html of markdown file to be rendered
142+
- `subsection` \[mandatory\] - nested nodes, can be either pages or subsections
143+
144+
The `Subsection` can omit `title` or `index`, however not specifying any of these properties disables you from giving the title of the section.
145+
146+
The `Blog` is a special node represented by simple entry `- title: Blog` with no other attirbutes. All your blogposts will be automatically linked under this section. You can read more about blog [here](blog.md).
119147

120148
```
121149
├── blog
@@ -126,6 +154,25 @@ You can read more about blog [here](blog.md).
126154
└── sidebar.yml
127155
```
128156

157+
## Hierarchy of title
158+
159+
There is a possibility to give custom title using `sidebar.yml`. The default strategy when choosing title for:
160+
161+
#### Page
162+
163+
1. `title` from the `front-matter` of the markdown/html file
164+
2. `title` property from the `sidebar.yml` property
165+
3. filename
166+
167+
#### Subsection
168+
169+
1. `title` from the `front-matter` of the markdown/html index file
170+
2. `title` property from the `sidebar.yml` property
171+
3. filename
172+
173+
Note that if you skip `index` file in your tree structure of you don't specify the `title` in the frontmatter, there will be given generic name `index`. The same applies when using `sidebar.yml` but not specifying `title` nor `index`, just a subsection. Again, generic `index` name will appear.
174+
175+
129176
## Static resources
130177

131178
You can attach static resources (pdf, images) to your documentation by using two dedicated directories:

0 commit comments

Comments
 (0)