Skip to content

Commit 066040d

Browse files
committed
update docs index to reflect README
1 parent 3a6123c commit 066040d

File tree

1 file changed

+134
-22
lines changed

1 file changed

+134
-22
lines changed

docs/source/index.md

Lines changed: 134 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,151 @@
22
title: Elastic Docs v3
33
---
44

5-
Elastic Docs v3 is built with
5+
You've reached the home of the latest incarnation of the documentation tooling.
66

7-
Test during zoom with colleen
7+
This repository is host to:
88

9-
TODO ADD README for doc-builder
9+
* *`docs-builder`* command line tool to generate single doc-sets (13mb native code, no dependencies)
10+
* *`docs-assembler`* command line tool to assemble all the doc sets. (IN PROGRESS)
11+
* `elastic/docs-builder@main` Github Action to build and validate a repositories documentation
1012

11-
:::{tip}
12-
On the right side of every page, there is an `Edit this page` link that you can use to see the markdown source for that page.
13-
:::
13+
## Command line interface
1414

15-
:::{admonition} My custom title with *Markdown*!
16-
:class: tip
15+
```
16+
$ docs-builder --help
17+
Usage: [command] [options...] [-h|--help] [--version]
18+
19+
Converts a source markdown folder or file to an output folder
20+
21+
Options:
22+
-p|--path <string?> Defaults to the`{pwd}/docs` folder (Default: null)
23+
-o|--output <string?> Defaults to `.artifacts/html` (Default: null)
24+
--path-prefix <string?> Specifies the path prefix for urls (Default: null)
25+
--force <bool?> Force a full rebuild of the destination folder (Default: null)
26+
27+
Commands:
28+
generate Converts a source markdown folder or file to an output folder
29+
serve Continuously serve a documentation folder at http://localhost:5000.
30+
File systems changes will be reflected without having to restart the server.
31+
```
32+
33+
In the near term native code will be published by CI for the following platforms
34+
35+
| OS | Architectures |
36+
|----------|---------------|
37+
| Windows | x64, Arm64 |
38+
| Linux | x64, Arm64 |
39+
| macOS | x64, Arm64 |
40+
41+
And we'll invest time in making sure these are easily obtainable (`brew`, `winget`, `apt`)
42+
43+
For now you can run the tool locally through `docker run`
44+
45+
```bash
46+
docker run -v "./.git:/app/.git" -v "./docs:/app/docs" -v "./.artifacts:/app/.artifacts" \
47+
ghcr.io/elastic/docs-builder:edge
48+
```
49+
50+
This ensures `.git`/`docs` and `.artifacts` (the default output directory) are mounted.
51+
52+
The tool will default to incremental compilation.
53+
Only the changed files on subsequent runs will be compiled unless you pass `--force`
54+
to force a new compilation.
55+
56+
```bash
57+
docker run -v "./.git:/app/.git" -v "./docs:/app/docs" -v "./.artifacts:/app/.artifacts" \
58+
ghcr.io/elastic/docs-builder:edge --force
59+
```
60+
61+
#### Live mode
62+
63+
Through the `serve` command you can continuously and partially compile your documentation.
64+
65+
```bash
66+
docker run -v "./.git:/app/.git" -v "./docs:/app/docs" -v "./.artifacts:/app/.artifacts" \
67+
--expose 8080 ghcr.io/elastic/docs-builder:edge serve
68+
```
69+
70+
Each page is compiled on demand as you browse http://localhost:8080 and is never cached so changes to files and
71+
navigation will always be reflected upon refresh.
1772

18-
This is a custom title for a tip admonition.
19-
:::
73+
Note the docker image is `linux-x86` and will be somewhat slower to invoke on OSX due to virtualization.
2074

21-
````{note}
22-
The next info should be nested
23-
```{warning}
24-
Here's my warning
75+
76+
## Github Action
77+
78+
The `docs-builder` tool is available as github action.
79+
80+
Since it runs from a precompiled distroless image `~25mb` it's able to execute snappy. (no need to wait for building the tool itself)
81+
82+
83+
```yaml
84+
jobs:
85+
docs:
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v4
89+
- name: Build documentation
90+
uses: elastic/docs-builder@main
91+
```
92+
93+
94+
95+
### GitHub Pages
96+
97+
To setup the tool to publish to GitHub pages use the following configuration.
98+
**NOTE**: In the near feature we'll make this a dedicated single step Github ction
99+
100+
```yaml
101+
steps:
102+
- id: repo-basename
103+
run: 'echo "value=`basename ${{ github.repository }}`" >> $GITHUB_OUTPUT'
104+
- uses: actions/checkout@v4
105+
- name: Setup Pages
106+
id: pages
107+
uses: actions/[email protected]
108+
- name: Build documentation
109+
uses: elastic/docs-builder@main
110+
with:
111+
prefix: '${{ steps.repo-basename.outputs.value }}'
112+
- name: Upload artifact
113+
uses: actions/[email protected]
114+
with:
115+
path: .artifacts/docs/html
116+
117+
- name: Deploy artifact
118+
id: deployment
119+
uses: actions/[email protected]
25120
```
26-
````
27121
122+
Note `prefix:` is required to inject the appropiate `--path-prefix` argument to `docs-builder`
123+
124+
Also make sure your repository settings are set up to deploy from github actions see:
125+
126+
https://github.com/elastic/{your-repository}/settings/pages
127+
128+
---
129+
![_static/img/github-pages.png](_static/img/github-pages.png)
130+
131+
---
132+
133+
## Run without docker
28134

29-
```javascript
30-
const variable = "hello world";
135+
If you have dotnet 8 installed you can use its CLI to publish a self-contained `docs-builder` native code
136+
binary. (On my M2 Pro mac the binary is currently 13mb)
137+
138+
```bash
139+
$ dotnet publish "src/docs-builder/docs-builder.csproj" -c Release -o .artifacts/publish \
140+
--self-contained true /p:PublishTrimmed=true /p:PublishSingleFile=false /p:PublishAot=true -a arm64
31141
```
32142

33-
## Feedback
143+
**Note**: `-a` should be the machines CPU architecture
144+
145+
The resulting binary `./.artifacts/publish/docs-builder` will run on machines without .NET installed
34146

35-
Hate it? Love it? We want to hear it all. Say hello and leave your thoughts in [#elastic-docs-v3](https://elastic.slack.com/archives/C07APH4RCDT).
147+
# Performance
36148

37-
## Build the docs locally
149+
To test performance it's best to build the binary and run outside of docker:
38150

39-
Hosted docs are great and all, but what's the contributor experience like?
40-
Read the [quick start guide](https://github.com/elastic/markitpy/tree/main), clone the repository, and spin up the docs locally in seconds.
151+
For refence here's the `markitpy-doc` docset (50k markdown files) currently takes `14s` vs `several minutes` compared to
152+
existing surveyed tools

0 commit comments

Comments
 (0)