Skip to content

Commit f11df79

Browse files
authored
Merge pull request #53 from mirzakopic/feat/docs-pages
feat: docs website for api-syncagent
2 parents e6be33c + 20d78a9 commit f11df79

21 files changed

+552
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
*.kubeconfig
99
*.pem
1010
*.key
11+
.DS_Store
12+
/docs/__pycache__
13+
.idea/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/publish-resources.md renamed to docs/content/publish-resources.md

Lines changed: 2 additions & 0 deletions
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]"
203204
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.

docs/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

docs/mkdocs.yml

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

0 commit comments

Comments
 (0)