helm-docs icon indicating copy to clipboard operation
helm-docs copied to clipboard

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

Open walthhy opened this issue 3 years ago • 4 comments

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:

walthhy avatar Dec 10 '21 03:12 walthhy

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

jullianow avatar Dec 29 '21 20:12 jullianow

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

norwoodj avatar Apr 25 '22 18:04 norwoodj

@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.

mjnagel avatar Apr 25 '22 19:04 mjnagel

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 (|).

bukowa avatar Nov 06 '22 19:11 bukowa