Skip to content

Commit 1815dcf

Browse files
committed
Add basic documentation
1 parent 0fb402a commit 1815dcf

File tree

8 files changed

+196
-2
lines changed

8 files changed

+196
-2
lines changed

docs/docs/usage/dottydoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: doc-page
3-
title: Dottydoc
3+
title: Dottydoc [Legacy]
44
---
55

66
Dottydoc is a tool to generate a combined documentation and API reference for

docs/docs/usage/scala3doc/blog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Build-in blog
3+
---
4+
5+
# {{page.title}}
6+
7+
Scala3doc is capable to include blogposts. For now we support only simple blogposts but in future we plan to include more advanced features like tags.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: API Documentation
3+
---
4+
5+
# {{ page.title }}
6+
7+
Scala3doc main feature is to create API documentation based on [doc comments](https://docs.scala-lang.org/style/scaladoc.html) known from scaladoc as well well as new syntax introduced in Scala 3.

docs/docs/usage/scala3doc/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Scala3doc
3+
---
4+
5+
![Scala3doc logo](/images/scala3doc-logo.png)
6+
7+
Scala3doc is a doctool dedicated to work with Scala 3.0. Beside basic features similar to `javadoc` or `scaladoc`. As you probably guessed, this
8+
whole site was created using scala3doc.
9+
10+
{% for post in site.posts %}
11+
## [{{ post.title }}](/{{ post.url }})
12+
13+
{{ post.excerpt }}
14+
15+
[ (read more) ](/{{ post.url }})
16+
17+
{% endfor %}
18+
19+
## Other extensions
20+
21+
We would love to have your feedback on what you think would be good in order to
22+
render the documentation you want! Perhaps you would like to render method
23+
definitions or members? Let us know by filing
24+
[issues](https://github.com/lampepfl/dotty/issues/new)!
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Dottydoc Specific Tags and Behavior
3+
---
4+
5+
# {{page.title}}
6+
7+
Scala3doc extemds markdown with some unique behaviours such as linking to API. This can be used from within static documentation and blogpost to provide blend-in content.
8+
9+
## Linking to API
10+
11+
If you for instance, want to link to `scala.collection.immutable.Seq` in a
12+
markdown file, you can simply use the canonical path in your url:
13+
14+
```markdown
15+
[Seq](scala.collection.immutable.Seq)
16+
```
17+
18+
Linking to members is done in the same fashion:
19+
20+
```markdown
21+
[Seq](scala.collection.immutable.Seq.isEmpty)
22+
```
23+
24+
Scala3doc denotes objects by ending their names in "$". To select `List.range`
25+
you'd therefore write:
26+
27+
```markdown
28+
[List.range](scala.collection.immutable.List$.range)
29+
```
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
---
2+
title: Static docucmentation
3+
---
4+
5+
# {{ page.title}}
6+
7+
Scala3doc has similar functionalites to [Jekyll](http://jekyllrb.com/) to allow users to documentation in form of static sit alongside your APIs. Moreover having a combined tool allows provide reach interaction between those to such as linking thus allowing the two to
8+
blend naturally.
9+
10+
Creating a site is just as simple as in Jekyll. The site root contains the
11+
layout of the site and all files placed here will be either considered static,
12+
or processed for template expansion.
13+
14+
The files that are considered for template expansion must end in `*.{html,md}`
15+
and will from here on be referred to as "template files" or "templates".
16+
17+
A simple "hello world" site could look something like this:
18+
19+
```
20+
├── docs
21+
│ └── getting-started.md
22+
└── index.html
23+
```
24+
25+
This will give you a site with the following files in genrated documentation:
26+
27+
```
28+
index.html
29+
docs/getting-started.html
30+
```
31+
32+
Scala3doc can transform both files and directories (to organize your documentation into tree-like structure). By default directories has title based on file name and has empty content. There is an option to include `index.html` or `index.md` (not both) to provide both content and properties like title (see [Properties](#properties)).
33+
34+
## Properties
35+
36+
Scala3doc uses the [Liquid](https://shopify.github.io/liquid/) templating engine
37+
and provides a number of custom filters and tags specific to Scala
38+
documentation.
39+
40+
In Scala3doc, all templates can contain YAML front-matter. The front-matter
41+
is parsed and put into the `page` variable available in templates via Liquid.
42+
43+
Scala3doc uses some predefied properties to controls some aspect of page.
44+
45+
Predefiend properties:
46+
47+
- **title** provide page title that will be used in navigation and html metadata.
48+
- **extraCss** additional `.css` files that will be included in this page. Paths should be relative to documentation root. **This setting is not exported to template engine**
49+
- **extraJs** additional `.js` files that will be included in this page. Paths should be relative to documentation root. **This setting is not exported to template engine**
50+
- **hasFrame** when set to `false` page will not include default layout (navigation, breadcrumbs etc.) but only token html wrapper to provide metadata and resources (js and css files)
51+
- **layout** - predefined layout to use, see below
52+
53+
54+
## Using existing Templates and Layouts
55+
56+
To perform template expansion, Dottydoc looks at `layout` in the front-matter.
57+
Here's a simple example of the templating system in action, `index.html`:
58+
59+
```html
60+
---
61+
layout: main
62+
---
63+
64+
<h1>Hello world!</h1>
65+
```
66+
67+
With a simple main template like this:
68+
69+
{% raw %}
70+
```html
71+
<html>
72+
<head>
73+
<title>Hello, world!</title>
74+
</head>
75+
<body>
76+
{{ content }}
77+
</body>
78+
</html>
79+
```
80+
81+
Would result in `{{ content }}` being replaced by `<h1>Hello world!</h1>` from
82+
the `index.html` file.
83+
{% endraw %}
84+
85+
Layouts must be placed in a `_layouts` directory in the site root:
86+
87+
```
88+
├── _layouts
89+
│ └── main.html
90+
├── docs
91+
│ └── getting-started.md
92+
└── index.html
93+
```
94+
95+
Sidebar
96+
=======
97+
Scala3doc by default use layout of files in `docs` directory to create table of content. There is also ability to override it by providing a `sidebar.yml` file in the site root:
98+
99+
```yaml
100+
sidebar:
101+
- title: Blog
102+
url: blog/index.html
103+
- title: Docs
104+
url: docs/index.html
105+
- title: Usage
106+
subsection:
107+
- title: Dottydoc
108+
url: docs/usage/dottydoc.html
109+
- title: sbt-projects
110+
url: docs/usage/sbt-projects.html
111+
```
112+
113+
The `sidebar` key is mandatory, as well as `title` for each element. The
114+
default table of contents allows you to have subsections - albeit the current
115+
depth limit is 2 however it accepts both files and directories and latter can be used to provide deeper structures.
116+
117+
The items which have the `subsection` does not accepts `url` section.
118+
119+
```
120+
├── blog
121+
│ └── _posts
122+
│ └── 2016-12-05-implicit-function-types.md
123+
├── index.html
124+
└── sidebar.yml
125+
```

docs/images/scala3doc-logo.png

25 KB
Loading

docs/sidebar.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ sidebar:
1515
url: docs/usage/language-versions.html
1616
- title: cbt-projects
1717
url: docs/usage/cbt-projects.html
18-
- title: Dottydoc
18+
- title: Scala3doc
19+
url: docs/usage/scala3doc
20+
- title: Dottydoc [Legacy]
1921
url: docs/usage/dottydoc.html
2022
- title: Reference
2123
subsection:

0 commit comments

Comments
 (0)