norwoodj / helm-docs

A tool for automatically generating markdown documentation for helm charts
GNU General Public License v3.0
1.34k stars 181 forks source link

can helm-docs handle `|` in comments properly? #118

Open walthhy opened 2 years ago

walthhy commented 2 years ago

In my values.yaml, I have follow code and comments

# -- certifications
# use `|` for multiple lines
CaCert:

and in README.md, helm-docs generated following code

| CaCert | string | `nil` | certifications. use `|` for multiple lines |

'|' will be treated as table column separator which is not good. So "for multiple lines" are missing for md view

My workaround is to add '\' before |. but it's tedious if we look at values.yaml comments, it seems to let user to input \| after CaCert

# -- certifications
# use `\|` for multiple lines
CaCert:
jullianow commented 2 years ago

I have the same problem, but in this case when I set a default value I use the for better organization.

norwoodj commented 2 years ago

Hmm, this is a bug. If you submit a PR, I'll merge it.

mjnagel commented 2 years ago

@norwoodj would you also conditionally support escaping | in the actual values? Example:

# -- This is an example value
example: "{{ .Values.other | base64encode }}"

When this gets rendered by the markdown rendering in Gitlab it breaks the table, but I've noticed markdown rendering on other places will correctly print it because it is inside of code backticks. I have a fork that handles this but it is not conditional. If you think that's worth supporting I can try to get a PR up shortly that handles both of these situations.

EDIT: Opened a PR here - https://github.com/norwoodj/helm-docs/pull/138 - if you're opposed to supporting a conditional escape on the values themselves the fix for comments is there as well and I can separate out the changes.

bukowa commented 1 year ago

This works for me https://github.com/norwoodj/helm-docs/pull/138#issuecomment-1150112214

But replace for this: https://www.markdownguide.org/extended-syntax/#escaping-pipe-characters-in-tables

Escaping Pipe Characters in Tables
You can display a pipe (|) character in a table by using its HTML character code (|).