Skip to content

Commit 2e9de7c

Browse files
committed
chore: slightly changes format of @default values as they're rendered in the mardown output
1 parent 3c4fdb2 commit 2e9de7c

File tree

6 files changed

+125
-107
lines changed

6 files changed

+125
-107
lines changed

example-charts/custom-template/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ culpa qui officia deserunt mollit anim id est laborum.
2929
| controller.image.tag | string | `"18.0831"` | |
3030
| controller.ingressClass | string | `"nginx"` | Name of the ingress class to route through this controller |
3131
| controller.name | string | `"controller"` | |
32-
| controller.persistentVolumeClaims | list | Use this to override the default value specified here in the file | List of persistent volume claims to create. For very long comments, break them into multiple lines. |
32+
| controller.persistentVolumeClaims | list | `["default", "specified", "here"]` | List of persistent volume claims to create. For very long comments, break them into multiple lines. |
3333
| controller.podLabels | object | `{}` | The labels to be applied to instances of the controller pod |
3434
| controller.publishService.enabled | bool | `false` | Whether to expose the ingress controller to the public world |
3535
| controller.replicas | int | `nil` | Number of nginx-ingress pods to load balance between |

example-charts/custom-template/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ controller:
66

77
# controller.persistentVolumeClaims -- List of persistent volume claims to create.
88
# For very long comments, break them into multiple lines.
9-
# @default -- Use this to override the default value specified here in the file
9+
# @default -- ["default", "specified", "here"]
1010
persistentVolumeClaims: []
1111

1212
extraVolumes:

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module github.com/norwoodj/helm-docs
22

3+
go 1.14
4+
35
require (
46
github.com/Masterminds/goutils v1.1.0 // indirect
57
github.com/Masterminds/semver v1.4.2 // indirect

pkg/document/values.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,20 @@ func createValueRow(
9595
return parseNilValueType(key, description), nil
9696
}
9797

98-
if description.Default == "" {
98+
defaultValue := description.Default
99+
if defaultValue == "" {
99100
jsonEncodedValue, err := json.Marshal(value)
100101
if err != nil {
101102
return valueRow{}, fmt.Errorf("failed to marshal default value for %s to json: %s", key, err)
102103
}
103104

104-
description.Default = fmt.Sprintf("`%s`", jsonEncodedValue)
105+
defaultValue = string(jsonEncodedValue)
105106
}
106107

107108
return valueRow{
108109
Key: key,
109110
Type: getTypeName(value),
110-
Default: description.Default,
111+
Default: fmt.Sprintf("`%s`", defaultValue),
111112
Description: description.Description,
112113
}, nil
113114
}

0 commit comments

Comments
 (0)