Skip to content

Commit 22382ff

Browse files
committed
Add README that can be used as context.
1 parent 4293e4f commit 22382ff

File tree

1 file changed

+146
-0
lines changed
  • src/Elastic.Documentation.Navigation

1 file changed

+146
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Elastic.Documentation.Navigation
2+
3+
This library provides a way to build navigation trees for documentation sets.
4+
5+
## Documentation Sets
6+
7+
When building single documentation sets you use docset.yml to declare the toc.
8+
9+
When we mention urls these are rooted at `/` unless `--canonical-base-url` is specified in which case the root is `/<canonical-base-url>`
10+
11+
```yaml
12+
toc:
13+
- file: index.md
14+
```
15+
16+
It supports the following children
17+
18+
### A single file
19+
20+
```yaml
21+
toc:
22+
- file: index.md
23+
- file: getting-started.md
24+
```
25+
These would result in the following Url's `/` and `/getting-started`
26+
27+
From here on out the expected url appears as comment in the example
28+
29+
### Folders
30+
31+
```yaml
32+
toc:
33+
- folder: getting-started # /getting-started
34+
- folder: syntax # /syntax
35+
children:
36+
- file: index.md #/syntax
37+
- file: blocks.md #/syntax/blocks
38+
```
39+
40+
* if `folder` does not specify children the folder will be scanned for Markdown files.
41+
* The url for the folder is the same as its index.
42+
* The index is determined by having an `index.md` otherwise it's the first file that is listed/found.
43+
* `children` paths are scope to the folder.
44+
* Here we are including the files `blocks.md` and `index.md` in the `syntax` folder.
45+
46+
### Virtual Files
47+
48+
```yaml
49+
toc:
50+
- file: index.md # /
51+
children:
52+
- file: getting-started.md # /getting-started
53+
- file: setup.md # /setup
54+
- folder: syntax # /syntax
55+
children:
56+
- file: blocks.md # /syntax/blocks
57+
- file: index.md # /syntax
58+
```
59+
60+
A file can specify `children` without having baring on it's children path on disk or url structure
61+
62+
```yaml
63+
toc:
64+
- file: getting-started.md # /getting-started
65+
children:
66+
- file: setup.md # /setup
67+
```
68+
69+
#### Deeplinking virtual files
70+
71+
```yaml
72+
toc:
73+
- file: a/b/c/getting-started.md # /a/b/c/getting-started
74+
children:
75+
- file: a/b/c/setup.md # /a/b/c/setup
76+
- file: c/b/c/setup.md # /c/b/c/setup
77+
```
78+
79+
While supported, this is not recommended.
80+
* Favor `folder` over `file` when possible.
81+
* Navigation should follow the file structure as much as possible.
82+
* Virtual files are primarely intended to group sibling files together.
83+
84+
`docs-builder` will hint when these guidelines are not followed.
85+
86+
87+
### Nested Table Of Contents
88+
89+
A `docset.yml` may include a `toc.yml` that itself contains a `toc` and may include more `toc.yml` files.
90+
91+
Given this `docset.yml`
92+
```yaml
93+
toc:
94+
- toc: getting-started # /getting-started
95+
- file: index.md # /
96+
```
97+
98+
`docs-builder` will include the `getting-started/toc.yml` file.
99+
100+
```yaml
101+
toc:
102+
- file: index.md # / getting-started
103+
- file: install.md # / getting-started/install
104+
```
105+
106+
Note that the `toc` creates a scope both for paths and urls.
107+
108+
A `toc` reference may **NOT** have children of its own and must appear at the top level of a `toc:` section inside a `docset.yml` or `toc.yml` file.
109+
110+
`docset.yml` defines how many levels deep we may include a `toc` reference. The default is `1`
111+
112+
```yaml
113+
max_toc_depth: 2
114+
```
115+
116+
117+
## Global Navigation.
118+
119+
The global navigation is defined in `config/navigation.yml` and is used to build a single global navigation for all documentation sets defined in `config/assembler.yml`.
120+
121+
The global navigation is built by
122+
* `docs-builder assemble`
123+
* or calling `docs-builder assmembler clone` and `docs-builder assmembler build`
124+
125+
`config/navigation.yml` links ALL `docset.yml` and `toc.yml` files.
126+
127+
Repositories in `config/assembler.yml` MAY be included in the global navigation. Once they do ALL their `docset.yml` and `toc.yml` files MUST be configured.
128+
129+
```yaml
130+
toc:
131+
- toc: get-started
132+
- toc: extend
133+
children:
134+
- toc: kibana://extend
135+
path_prefix: extend/kibana
136+
- toc: logstash://extend
137+
path_prefix: extend/logstash
138+
```
139+
140+
The toc follows a `<repository>://<path>` scheme.
141+
142+
* If `<repository>` is not defined it's the narrative repository (`docs-builder`).
143+
`path_prefix` is mandatory.
144+
* unless `<repository>` is not defined in which it defaults to `<path>`.
145+
* `path_prefix`'s MUST be unique
146+

0 commit comments

Comments
 (0)