Skip to content

Commit 141d188

Browse files
committed
docs: add docs website for api-syncagent
Signed-off-by: Mirza Kopic <[email protected]>
1 parent 219eae6 commit 141d188

18 files changed

+537
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
*.kubeconfig
99
*.pem
1010
*.key
11+
.DS_Store

docs/publish-resources.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ usual path, without a leading dot.
197197

198198
#### Template
199199

200+
{% raw %}
200201
```yaml
201202
template:
202203
path: "json.path[expression]"
203-
template: "{{ .LocalObject.ObjectMeta.Namespace }}"
204+
template: "{ { .LocalObject.ObjectMeta.Namespace } }"
204205
```
206+
{% endraw %}
205207

206208
This mutation applies a Go template expression to a single value inside the document. JSON path is the
207209
usual path, without a leading dot.

website/content

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../docs

website/main.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright 2023 The KCP Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import copy
16+
17+
def define_env(env):
18+
"""
19+
This is the hook for defining variables, macros, and filters. See
20+
https://mkdocs-macros-plugin.readthedocs.io/en/latest/macros/#the-define_env-function for more details.
21+
22+
:param env: the Jinja2 environment
23+
"""
24+
25+
@env.macro
26+
def section_items(page, nav, config):
27+
"""
28+
Returns a list of all pages that are siblings to page.
29+
30+
:param page: the current page. This will typically be an index.md page.
31+
:param nav: the mkdocs navigation object.
32+
:param config: the mkdocs config object.
33+
:return: a list of all the sibling pages.
34+
"""
35+
36+
if page.parent:
37+
children = page.parent.children
38+
else:
39+
children = nav.items
40+
41+
siblings = []
42+
for child in children:
43+
if child is page:
44+
# don't include the passed in page in the list
45+
continue
46+
if child.is_section:
47+
# don't include sections
48+
continue
49+
if child.file.name == 'index':
50+
# don't include index pages
51+
continue
52+
53+
# Because some pages might not have been loaded yet, we have to do so now, to get title/metadata.
54+
child.read_source(config)
55+
56+
# Copy so we don't modify the original
57+
child = copy.deepcopy(child)
58+
59+
# Subsection nesting that works across any level of nesting
60+
# Replaced mkdocs fix_url function
61+
child.file.url = child.url.replace(page.url, "./")
62+
siblings.append(child)
63+
64+
return siblings

website/mkdocs.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
site_name: docs.kcp.io/api-syncagent
2+
repo_url: https://github.com/kcp-dev/api-syncagent
3+
repo_name: kcp-dev/api-syncagent
4+
site_url: https://docs.kcp.io/api-syncagent/
5+
6+
# Site navigation
7+
nav:
8+
- Home: README.md
9+
- Getting Started: getting-started.md
10+
- Publishing Resources: publish-resources.md
11+
- Consuming Services: consuming-services.md
12+
- FAQ: faq.md
13+
14+
# Site content
15+
docs_dir: 'content'
16+
# Where to generate
17+
site_dir: 'generated'
18+
19+
theme:
20+
name: material
21+
language: en
22+
# Common files such as images, stylesheets, theme overrides
23+
custom_dir: 'overrides'
24+
features:
25+
# Enable navigation section index pages, so we don't see Concepts > Concepts
26+
- navigation.indexes
27+
# Enable navigation tabs so we can group content by persona
28+
- navigation.tabs
29+
# Expand subsections by default for better visibility of content
30+
- navigation.expand
31+
# Show "back to top" button
32+
- navigation.top
33+
# Enable a copy button in code blocks
34+
- content.code.copy
35+
# Enable annotations on specific lines in code blocks
36+
- content.code.annotate
37+
logo: logo.svg
38+
favicon: favicons/favicon.ico
39+
palette:
40+
# Palette toggle for automatic mode
41+
- media: "(prefers-color-scheme)"
42+
toggle:
43+
icon: material/brightness-auto
44+
name: Switch to light mode
45+
46+
# Palette toggle for light mode
47+
- media: "(prefers-color-scheme: light)"
48+
scheme: default
49+
primary: white
50+
toggle:
51+
icon: material/brightness-7
52+
name: Switch to dark mode
53+
54+
# Palette toggle for dark mode
55+
- media: "(prefers-color-scheme: dark)"
56+
scheme: slate
57+
primary: black
58+
toggle:
59+
icon: material/brightness-4
60+
name: Switch to system preference
61+
62+
extra_css:
63+
- stylesheets/crd.css
64+
65+
extra:
66+
version:
67+
# Enable mike for multi-version selection
68+
provider: mike
69+
70+
social:
71+
- icon: fontawesome/brands/github
72+
link: https://github.com/kcp-dev/kcp
73+
- icon: fontawesome/brands/slack
74+
link: https://kubernetes.slack.com/archives/C021U8WSAFK
75+
76+
plugins:
77+
# https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin
78+
# Greater control over how navigation links are shown
79+
- awesome-pages
80+
# Docs site search
81+
- search
82+
# Use Jinja macros in .md files
83+
- macros:
84+
include_dir: 'overrides'
85+
module_name: 'main'
86+
# Configure multiple language support
87+
- i18n:
88+
docs_structure: suffix
89+
fallback_to_default: true
90+
languages:
91+
- build: true
92+
default: true
93+
locale: en
94+
name: English
95+
reconfigure_material: true
96+
reconfigure_search: true
97+
# Configure multi-version plugin
98+
- mike:
99+
alias_type: redirect
100+
101+
markdown_extensions:
102+
# Code block highlighting
103+
- pymdownx.highlight:
104+
# Allows linking directly to specific lines in code blocks
105+
anchor_linenums: true
106+
- pymdownx.superfences:
107+
custom_fences:
108+
- name: mermaid
109+
class: mermaid
110+
format: !!python/name:pymdownx.superfences.fence_code_format
111+
# Inline code block highlighting
112+
- pymdownx.inlinehilite
113+
# Lets you embed content from another file
114+
- pymdownx.snippets
115+
# Arbitrary nesting of code/content blocks inside each other
116+
- pymdownx.superfences
117+
# Enable note/warning/etc. callouts
118+
- admonition
119+
120+
# Live reload if any of these change when running 'mkdocs serve'
121+
watch:
122+
- mkdocs.yml
123+
- content
124+
- overrides
13.3 KB
Loading
43 KB
Loading
9.56 KB
Loading
1.32 KB
Loading
2.09 KB
Loading

0 commit comments

Comments
 (0)