Skip to content

Preserve formatting of examples #39

Description

@very-doge-wow

My chart has a bunch of features which can be activated through the values.yaml. Those however aren't just switches, but can contain templating themselves. As an example, one might pass a complete custom object definition as a string:

# Define a list of custom objects as complete k8s object definition (with template strings included).
# Example:
# customObjects:
#   - |
#     apiVersion: v1
#     kind: Secret
#     metadata:
#       name: best-token-{{ include "chart.fullname" . }}
#     type: Opaque
#     data:
#       mykey: {{ uuidv4 | sha256sum | b64enc }}
customObjects: []

First of all it's nice to have the example feature, where one can include an example inside the description field. Sadly the formatting isn't preserved, i.e. all whitespace at the start of each line is trimmed, so that the actual output looks more like this:

image

Which of course would be the wrong format if a user wants to copy that example as a reference. Also in general it's hard to read, as one can not be sure which elements belong to which yaml object.

So I would like to propose to keep the original formatting. Maybe you could even introduce a new flag like # Code-Example or similiar, which would then keep all the formatting done in the strings below it.
If possible, it would also be nice if that code example would be wrapped inside a single codeblock, not one for each line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions