File tree Expand file tree Collapse file tree 8 files changed +109
-0
lines changed Expand file tree Collapse file tree 8 files changed +109
-0
lines changed Original file line number Diff line number Diff line change @@ -57,3 +57,5 @@ go.work.sum
57
57
.venv /
58
58
release /
59
59
site-src /reference /spec.md
60
+ site-src /reference /specx.md
61
+
Original file line number Diff line number Diff line change @@ -198,10 +198,12 @@ api-ref-docs:
198
198
crd-ref-docs \
199
199
--source-path=${PWD} /apis \
200
200
--config=crd-ref-docs.yaml \
201
+ --templates-dir=${PWD} /hack/crd-ref-templates/ \
201
202
--renderer=markdown \
202
203
--output-path=${PWD} /site-src/reference/spec.md
203
204
crd-ref-docs \
204
205
--source-path=${PWD} /apisx \
205
206
--config=crd-ref-docs.yaml \
207
+ --templates-dir=${PWD} /hack/crd-ref-templates/ \
206
208
--renderer=markdown \
207
209
--output-path=${PWD} /site-src/reference/specx.md
Original file line number Diff line number Diff line change
1
+ The templates contained in this directory were copied from https://github.com/elastic/crd-ref-docs/tree/master/templates/markdown
2
+ and had the following modifications:
3
+
4
+ - ` type.tpl ` - Adds an "experimental" marker in case the API field is marked as "experimental"
5
+ - ` type_members.tpl ` - Removes the text between tags ` <gateway:util:excludeFromCRD></gateway:util:excludeFromCRD> `
Original file line number Diff line number Diff line change
1
+ { {- define " gvDetails" -} }
2
+ { {- $gv := . -} }
3
+
4
+ ## { { $gv .GroupVersionString } }
5
+
6
+ { { $gv .Doc } }
7
+
8
+ { {- if $gv .Kinds } }
9
+ ### Resource Types
10
+ { {- range $gv .SortedKinds } }
11
+ - { { $gv .TypeForKind . | markdownRenderTypeLink } }
12
+ { {- end } }
13
+ { { end } }
14
+
15
+ { { range $gv .SortedTypes } }
16
+ { { template " type" . } }
17
+ { { end } }
18
+
19
+ { {- end -} }
Original file line number Diff line number Diff line change
1
+ { {- define " gvList" -} }
2
+ { {- $groupVersions := . -} }
3
+
4
+ # API Reference
5
+
6
+ ## Packages
7
+ { {- range $groupVersions } }
8
+ - { { markdownRenderGVLink . } }
9
+ { {- end } }
10
+
11
+ { { range $groupVersions } }
12
+ { { template " gvDetails" . } }
13
+ { { end } }
14
+
15
+ { {- end -} }
Original file line number Diff line number Diff line change
1
+ { {- define " type" -} }
2
+ { {- $type := . -} }
3
+ { {- if markdownShouldRenderType $type -} }
4
+
5
+ #### { { $type .Name } }
6
+
7
+ { { if $type .IsAlias } }_Underlying type:_ _{ { markdownRenderTypeLink $type .UnderlyingType } }_{ { end } }
8
+
9
+ { { $type .Doc } }
10
+
11
+ { { if $type .Validation -} }
12
+ _Validation:_
13
+ { {- range $type .Validation } }
14
+ - { { . } }
15
+ { {- end } }
16
+ { {- end } }
17
+
18
+ { { if $type .References -} }
19
+ _Appears in:_
20
+ { {- range $type .SortedReferences } }
21
+ - { { markdownRenderTypeLink . } }
22
+ { {- end } }
23
+ { {- end } }
24
+
25
+ { { if $type .Members -} }
26
+ | Field | Description | Default | Validation |
27
+ | --- | --- | --- | --- |
28
+ { { if $type .GVK -} }
29
+ | `apiVersion` _string_ | `{ { $type .GVK.Group } }/{ { $type .GVK.Version } }` | | |
30
+ | `kind` _string_ | `{ { $type .GVK.Kind } }` | | |
31
+ { { end -} }
32
+
33
+ { { range $type .Members -} }
34
+ | `{ { .Name } }` _{ { markdownRenderType .Type } }_ { {- if contains " <gateway:experimental>" .Doc -} }<br />**Experimental**{ { end -} }| { { template " type_members" . } } | { { markdownRenderDefault .Default } } | { { range .Validation -} } { { markdownRenderFieldDoc . } } <br />{ { end } } |
35
+ { { end -} }
36
+
37
+ { { end -} }
38
+
39
+ { { if $type .EnumValues -} }
40
+ | Field | Description |
41
+ | --- | --- |
42
+ { { range $type .EnumValues -} }
43
+ | `{ { .Name } }` | { { markdownRenderFieldDoc .Doc } } |
44
+ { { end -} }
45
+ { { end -} }
46
+
47
+
48
+ { {- end -} }
49
+ { {- end -} }
Original file line number Diff line number Diff line change
1
+ { {- define " type_members" -} }
2
+ { {- $field := . -} }
3
+ { {- if eq $field .Name " metadata" -} }
4
+ Refer to Kubernetes API documentation for fields of `metadata`.
5
+ { {- else -} }
6
+ { {- $cleanDoc := regexReplaceAllLiteral " (?s)<gateway:util:excludeFromCRD>.*?</gateway:util:excludeFromCRD>" $field .Doc " " -} }
7
+ { { markdownRenderFieldDoc $cleanDoc } }
8
+ { {- end -} }
9
+ { {- end -} }
Original file line number Diff line number Diff line change @@ -32,5 +32,13 @@ go install github.com/elastic/crd-ref-docs
32
32
${GOBIN} /crd-ref-docs \
33
33
--source-path=${PWD} /apis \
34
34
--config=crd-ref-docs.yaml \
35
+ --templates-dir=${PWD} /hack/crd-ref-templates/ \
35
36
--renderer=markdown \
36
37
--output-path=${PWD} /site-src/reference/spec.md
38
+
39
+ ${GOBIN} /crd-ref-docs \
40
+ --source-path=${PWD} /apisx \
41
+ --config=crd-ref-docs.yaml \
42
+ --templates-dir=${PWD} /hack/crd-ref-templates/ \
43
+ --renderer=markdown \
44
+ --output-path=${PWD} /site-src/reference/specx.md
You can’t perform that action at this time.
0 commit comments