helm-docs
helm-docs copied to clipboard
Cannot include mustache/handlebar templates in example docs
I was unable to find a way to "escape" code examples that contain mustache/handlebar templates that I may want to place in a README. Not surprisingly, it seems helm-docs tries to parse them as a go template. For example
My chart
Find the labelled pod
helper_pod="$(kubectl get pod -l app=my-app --template '{{range .items}}{{.metadata.name}}{{end}}')"
You should be able to escape the {{
s:
helper_pod="$(kubectl get pod -l app=my-app --template '{{ `{{range .items}}` }} {{`{{.metadata.name}}`}} {{`{{end}}`}}')"
produces:
helper_pod="$(kubectl get pod -l app=my-app --template '{{range .items}} {{.metadata.name}} {{end}}')"
https://felix.ehrenpfort.de/notes/2022-03-01-escape-curly-braces-in-go-templates/
Did it work @AlanMasciangelo ?