improve formatting of values table#106
Conversation
|
Hey @kd7lxl I like this change in principle and I'm sorry I hadn't looked at this until now. I have only one concern. I think quoted key components which contain dots should be left alone, e.g. |
|
Another idea to avoid horizontal scrolling of both keys and values: Created with {{- /*
Copy of `defaultDocumentationTemplate` from
https://github.com/norwoodj/helm-docs/blob/master/pkg/document/template.go
with `chart.valuesTable` redefined to avoid horizontal scrolling.
*/}}
{{- define "chart.valuesTable" }}
| Key | Type | Default | Description |
|-----|------|---------|-------------|
{{- range .Values }}
{{- "\n| "}}{{ .Key | replace "." "<br>." }}
{{- " | "}}{{ .Type }}
{{- " | "}}{{ (default .Default .AutoDefault) | replace "," ",`<br>`" }}
{{- " | "}}{{ default .Description .AutoDescription }}
{{- " | "}}
{{- end }}
{{- end }}
{{- template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}
{{ template "chart.maintainersSection" . }}
{{ template "chart.sourcesSection" . }}
{{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }}
{{- if not .SkipVersionFooter }}
{{ template "helm-docs.versionFooter" . }}
{{- end }} |
|
Combining the suggestions from above, I've found the following to be the most helpful template: This also works great for forges other than GH which have a fixed-width table layout. Example Forgejo Without the addition of There's still room for improvement, especially for the @norwoodj Any interest in patching this for the next version? Seems like a long-standing "issue" which could be improved. |
|
I'm not sure how I feel about this still. I like being able to view the markdown in plaintext, and this kinda wrecks that: |
|
Reopen this if you fix the issue above and the merge conflicts |


Deeply nested values can cause the values table to grow really wide. The key field is not wrapped by default. Example: https://github.com/cortexproject/cortex-helm-chart/blob/cc9ef3dc/README.md#values
By adding zero-width spaces after the
.s in the keys, the browser will wrap long keys when needed. Here's an example, notice the table is much narrower and much more readable:https://github.com/cortexproject/cortex-helm-chart/blob/f6454e5/README.md#values