Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions example/crds/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ spec:
default: 7
minimum: 0
maximum: 10
sample:
description: 'Selects a field of the pod:
supports metadata.name, metadata.namespace,
`metadata.labels[''<KEY>'']`, `metadata.annotations[''<KEY>'']`,
spec.nodeName, spec.serviceAccountName,
status.hostIP, status.podIP, status.podIPs.'
text:
description: Just text
type: string
Expand Down
7 changes: 7 additions & 0 deletions example/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ Resource Types:
<i>Maximum</i>: 10<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>sample</b></td>
<td></td>
<td>
Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>text</b></td>
<td>string</td>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module fybrik.io/crdoc
module github.com/eloycoto/crdoc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please return back the module name


go 1.17

Expand Down
3 changes: 3 additions & 0 deletions pkg/functions/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@

package functions

import "html"

var ExportedMap = map[string]interface{}{
// Strings
"anchorize": Anchorize,
"anchorizeAsciiOnly": AnchorizeAsciiOnly,
"escape": html.EscapeString,
}
4 changes: 2 additions & 2 deletions templates/frontmatter.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: {{or .Metadata.Title "API Reference"}}
weight: {{or .Metadata.Weight 1 }}
{{- if .Metadata.Description}}
description: {{.Metadata.Description}}
description: {{ escape .Metadata.Description}}
{{- end}}
---

Expand Down Expand Up @@ -71,7 +71,7 @@ Resource Types:
<td><b>{{if .TypeKey}}<a href="{{.TypeKey}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}</b></td>
<td>{{.Type}}</td>
<td>
{{.Description}}<br/>
{{ escape .Description }}<br/>
{{- if or .Schema.Format .Schema.Enum .Schema.Default .Schema.Minimum .Schema.Maximum }}
<br/>
{{- end}}
Expand Down
6 changes: 3 additions & 3 deletions templates/markdown.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Resource Types:
{{end}}


{{.Description}}
{{escape .Description}}

<table>
<thead>
Expand Down Expand Up @@ -65,7 +65,7 @@ Resource Types:
<td><b>{{if .TypeKey}}<a href="#{{.TypeKey}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}</b></td>
<td>{{.Type}}</td>
<td>
{{.Description}}<br/>
{{ escape .Description}}<br/>
{{- if or .Schema.Format .Schema.Enum .Schema.Default .Schema.Minimum .Schema.Maximum }}
<br/>
{{- end}}
Expand Down Expand Up @@ -93,4 +93,4 @@ Resource Types:

{{- end}}{{/* range .Types */}}
{{- end}}{{/* range .Kinds */}}
{{- end}}{{/* range .Groups */}}
{{- end}}{{/* range .Groups */}}