-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: improve api type members (#2544)
* docs: improve api type members Signed-off-by: zirain <[email protected]> * nits Signed-off-by: zirain <[email protected]> --------- Signed-off-by: zirain <[email protected]>
- Loading branch information
Showing
7 changed files
with
645 additions
and
568 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Original from https://github.com/elastic/crd-ref-docs/tree/9a3105b6ca763ea03393fa6f396046ad7b5d4e38/templates/markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- define "gvDetails" -}} | ||
{{- $gv := . -}} | ||
|
||
## {{ $gv.GroupVersionString }} | ||
|
||
{{ $gv.Doc }} | ||
|
||
{{- if $gv.Kinds }} | ||
### Resource Types | ||
{{- range $gv.SortedKinds }} | ||
- {{ $gv.TypeForKind . | markdownRenderTypeLink }} | ||
{{- end }} | ||
{{ end }} | ||
|
||
{{ range $gv.SortedTypes }} | ||
{{ template "type" . }} | ||
{{ end }} | ||
|
||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- define "gvList" -}} | ||
{{- $groupVersions := . -}} | ||
|
||
# API Reference | ||
|
||
## Packages | ||
{{- range $groupVersions }} | ||
- {{ markdownRenderGVLink . }} | ||
{{- end }} | ||
|
||
{{ range $groupVersions }} | ||
{{ template "gvDetails" . }} | ||
{{ end }} | ||
|
||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{{- define "type" -}} | ||
{{- $type := . -}} | ||
{{- if markdownShouldRenderType $type -}} | ||
|
||
#### {{ $type.Name }} | ||
|
||
{{ if $type.IsAlias }}_Underlying type:_ _{{ markdownRenderTypeLink $type.UnderlyingType }}_{{ end }} | ||
|
||
{{ $type.Doc }} | ||
|
||
{{ if $type.References -}} | ||
_Appears in:_ | ||
{{- range $type.SortedReferences }} | ||
- {{ markdownRenderTypeLink . }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{ if $type.Members -}} | ||
| Field | Type | Description | | ||
| --- | --- | --- | | ||
{{ if $type.GVK -}} | ||
| `apiVersion` | _string_ | `{{ $type.GVK.Group }}/{{ $type.GVK.Version }}` | ||
| `kind` | _string_ | `{{ $type.GVK.Kind }}` | ||
{{ end -}} | ||
|
||
{{ range $type.Members -}} | ||
| `{{ .Name }}` | _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | | ||
{{ end -}} | ||
|
||
{{ end -}} | ||
|
||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{- define "type_members" -}} | ||
{{- $field := . -}} | ||
{{- if eq $field.Name "metadata" -}} | ||
Refer to Kubernetes API documentation for fields of `metadata`. | ||
{{- else -}} | ||
{{ markdownRenderFieldDoc $field.Doc }} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters