Skip to content

Commit

Permalink
use mkdocs-awesome-pages-plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Oct 9, 2023
1 parent e11c8fc commit 181f2d0
Show file tree
Hide file tree
Showing 38 changed files with 192 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ codegen-mkdocs: codegen-docs ## Generate mkdocs website
@echo Generate mkdocs website... >&2
@pip3 install mkdocs
@pip3 install --upgrade pip
@pip3 install -U mkdocs-material mkdocs-redirects mkdocs-minify-plugin mkdocs-include-markdown-plugin lunr mkdocs-rss-plugin
@pip3 install -U mkdocs-material mkdocs-redirects mkdocs-minify-plugin mkdocs-include-markdown-plugin lunr mkdocs-rss-plugin mkdocs-awesome-pages-plugin
@rm -rf ./website/docs/apis && mkdir -p ./website/docs/apis && cp docs/user/apis/md/* ./website/docs/apis
@rm -rf ./website/docs/commands && mkdir -p ./website/docs/commands && cp docs/user/commands/* ./website/docs/commands
@rm -rf ./website/docs/jp && mkdir -p ./website/docs/jp && cp docs/user/jp/* ./website/docs/jp
Expand Down
9 changes: 5 additions & 4 deletions catalog/aws/policy-1.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
tags:
- aws
---
apiVersion: json.kyverno.io/v1alpha1
kind: Policy
metadata:
name: test
labels:
s3.aws.catalog.kyverno.io: ''
annotations:
title.catalog.kyverno.io: Policy 1
description.catalog.kyverno.io: Policy 1
spec:
rules:
- name: foo-bar
Expand Down
4 changes: 0 additions & 4 deletions catalog/ecs/policy-1.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
tags:
- ecs
---
apiVersion: json.kyverno.io/v1alpha1
kind: Policy
metadata:
Expand Down
38 changes: 38 additions & 0 deletions hack/docs/catalog/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"fmt"
"os"

"github.com/kyverno/kyverno-json/pkg/policy"
"sigs.k8s.io/yaml"
)

func main() {
policies, err := policy.Load("./catalog")
if err != nil {
panic(err)
}
for i, policy := range policies {
f, err := os.Create("website/docs/catalog/policies/" + fmt.Sprintf("%d.md", i))
if err != nil {
panic(err)
}
defer f.Close()
bytes, err := yaml.Marshal(policy)
if err != nil {
panic(err)
}
fmt.Fprintln(f, "# "+policy.Annotations["title.catalog.kyverno.io"])
fmt.Fprintln(f)
fmt.Fprintln(f, policy.Annotations["description.catalog.kyverno.io"])
fmt.Fprintln(f)
fmt.Fprintln(f, "## Manifest")
fmt.Fprintln(f)
fmt.Fprintln(f, "```yaml")
if _, err := f.Write(bytes); err != nil {
panic(err)
}
fmt.Fprintln(f, "```")
}
}
8 changes: 8 additions & 0 deletions website/docs/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
nav:
- Home: index.md
- start
- policies
- Policy catalog:
- catalog/index.md
- playground
- blog
3 changes: 3 additions & 0 deletions website/docs/blog/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- Blog:
- index.md
18 changes: 0 additions & 18 deletions website/docs/catalog/aws/policy-1.md

This file was deleted.

19 changes: 0 additions & 19 deletions website/docs/catalog/ecs/policy-1.md

This file was deleted.

3 changes: 3 additions & 0 deletions website/docs/catalog/policies/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- 0.md
- 1.md
26 changes: 26 additions & 0 deletions website/docs/catalog/policies/0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Policy 1

Policy 1

## Manifest

```yaml
apiVersion: json.kyverno.io/v1alpha1
kind: Policy
metadata:
annotations:
description.catalog.kyverno.io: Policy 1
title.catalog.kyverno.io: Policy 1
creationTimestamp: null
labels:
s3.aws.catalog.kyverno.io: ""
name: test
spec:
rules:
- name: foo-bar
validate:
assert:
all:
- foo:
/(bar)/: 10
```
21 changes: 21 additions & 0 deletions website/docs/catalog/policies/1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#



## Manifest

```yaml
apiVersion: json.kyverno.io/v1alpha1
kind: Policy
metadata:
creationTimestamp: null
name: test
spec:
rules:
- name: foo-bar
validate:
assert:
all:
- foo:
/(bar)/: 10
```
3 changes: 3 additions & 0 deletions website/docs/playground/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- Playground:
- index.md
File renamed without changes.
13 changes: 13 additions & 0 deletions website/docs/policies/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
nav:
- Writing policies:
- index.md
- Basics:
- api-version.md
- match.md
- assertion-trees.md
- modifiers.md
- explicit-bindings.md
- escaping.md
- commands
- jp
- apis
3 changes: 3 additions & 0 deletions website/docs/policies/apis/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nav:
- APIs:
- v1alpha1: kyverno-json.v1alpha1.md
File renamed without changes.
15 changes: 15 additions & 0 deletions website/docs/policies/commands/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
nav:
- Command Line Usage:
- kyverno-json.md
- kyverno-json_completion.md
- kyverno-json_completion_bash.md
- kyverno-json_completion_fish.md
- kyverno-json_completion_powershell.md
- kyverno-json_completion_zsh.md
- kyverno-json_docs.md
- kyverno-json_jp.md
- kyverno-json_jp_function.md
- kyverno-json_jp_parse.md
- kyverno-json_jp_query.md
- kyverno-json_scan.md
- kyverno-json_version.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions website/docs/policies/jp/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nav:
- JMESPath:
- Overview: overview.md
- Functions: functions.md
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions website/docs/start/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nav:
- Getting Started:
- index.md
- install.md
- quick-start.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
86 changes: 44 additions & 42 deletions website/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ theme:

plugins:
- search
- awesome-pages:
strict: false
collapse_single_pages: true
# - redirects:
# redirect_maps:
# discord.md: https://discord.gg/RGEBtg8vQ6
Expand All @@ -71,48 +74,47 @@ plugins:
- blog:
post_url_format: "{slug}"

nav:
- Home: index.md
- Getting Started:
- intro.md
- install.md
- quick-start.md
- Writing policies:
- policies/index.md
- Basics:
- policies/api-version.md
- policies/match.md
- policies/assertion-trees.md
- policies/modifiers.md
- policies/explicit-bindings.md
- policies/escaping.md
- Command Line Usage:
- commands/kyverno-json.md
- commands/kyverno-json_completion.md
- commands/kyverno-json_completion_bash.md
- commands/kyverno-json_completion_fish.md
- commands/kyverno-json_completion_powershell.md
- commands/kyverno-json_completion_zsh.md
- commands/kyverno-json_docs.md
- commands/kyverno-json_jp.md
- commands/kyverno-json_jp_function.md
- commands/kyverno-json_jp_parse.md
- commands/kyverno-json_jp_query.md
- commands/kyverno-json_scan.md
- commands/kyverno-json_version.md
- JMESPath:
- Overview: jp.md
- Functions: jp/functions.md
- APIs:
- v1alpha1: apis/kyverno-json.v1alpha1.md
- Policy catalog:
- catalog/index.md
- catalog/aws/policy-1.md
- catalog/ecs/policy-1.md
- Playground:
- playground.md
- Blog:
- blog/index.md
# nav:
# - Home: index.md
# - Getting Started:
# - intro.md
# - install.md
# - quick-start.md
# - Writing policies:
# - policies/index.md
# - Basics:
# - policies/api-version.md
# - policies/match.md
# - policies/assertion-trees.md
# - policies/modifiers.md
# - policies/explicit-bindings.md
# - policies/escaping.md
# - Command Line Usage:
# - commands/kyverno-json.md
# - commands/kyverno-json_completion.md
# - commands/kyverno-json_completion_bash.md
# - commands/kyverno-json_completion_fish.md
# - commands/kyverno-json_completion_powershell.md
# - commands/kyverno-json_completion_zsh.md
# - commands/kyverno-json_docs.md
# - commands/kyverno-json_jp.md
# - commands/kyverno-json_jp_function.md
# - commands/kyverno-json_jp_parse.md
# - commands/kyverno-json_jp_query.md
# - commands/kyverno-json_scan.md
# - commands/kyverno-json_version.md
# - JMESPath:
# - Overview: jp.md
# - Functions: jp/functions.md
# - APIs:
# - v1alpha1: apis/kyverno-json.v1alpha1.md
# - Policy catalog:
# - catalog/index.md
# - catalog/policies
# - Playground:
# - playground.md
# - Blog:
# - blog/index.md

markdown_extensions:
- admonition
Expand Down

0 comments on commit 181f2d0

Please sign in to comment.