diff --git a/example-charts/custom-value-notation-type/README.md b/example-charts/custom-value-notation-type/README.md index 7170acc..bdcd025 100644 --- a/example-charts/custom-value-notation-type/README.md +++ b/example-charts/custom-value-notation-type/README.md @@ -103,7 +103,7 @@ file, you can see that we modified the column `Key` to also be hyperlinked with If you view this README.md files in GitHub and click the value's key, you will be directed to the key location in the `values.yaml` file. -You can also render a raw string into the comments using `@section` annotations. +You can also render a raw string into the comments using `@raw` annotations. You can jump to [sampleYaml](#sampleYaml) key and check it's description where it uses HTML `` tag to collapse some part of the comments. @@ -996,7 +996,7 @@ dict Sometimes you need a very long description for your values. -Any comment section for a given key with **@section** attribute +Any comment section for a given key with **@raw** attribute will be treated as raw string and stored as is. Since it generates in Markdown format, you can do something like this: diff --git a/example-charts/custom-value-notation-type/README.md.gotmpl b/example-charts/custom-value-notation-type/README.md.gotmpl index be2274c..2b76d84 100644 --- a/example-charts/custom-value-notation-type/README.md.gotmpl +++ b/example-charts/custom-value-notation-type/README.md.gotmpl @@ -97,7 +97,7 @@ file, you can see that we modified the column `Key` to also be hyperlinked with If you view this README.md files in GitHub and click the value's key, you will be directed to the key location in the `values.yaml` file. -You can also render a raw string into the comments using `@section` annotations. +You can also render a raw string into the comments using `@raw` annotations. You can jump to [sampleYaml](#sampleYaml) key and check it's description where it uses HTML `` tag to collapse some part of the comments. diff --git a/example-charts/custom-value-notation-type/values.yaml b/example-charts/custom-value-notation-type/values.yaml index bf08e89..ec77178 100644 --- a/example-charts/custom-value-notation-type/values.yaml +++ b/example-charts/custom-value-notation-type/values.yaml @@ -201,11 +201,11 @@ persistence: # -- (dict) Values with long description -# @section +# @raw # Sometimes you need a very long description # for your values. # -# Any comment section for a given key with **@section** attribute +# Any comment section for a given key with **@raw** attribute # will be treated as raw string and stored as is. # Since it generates in Markdown format, you can do something like this: # diff --git a/pkg/document/values_test.go b/pkg/document/values_test.go index d65436c..48af24d 100644 --- a/pkg/document/values_test.go +++ b/pkg/document/values_test.go @@ -1440,11 +1440,11 @@ foo: assert.Equal(t, "Bar!", valuesRows[0].AutoDescription) } -func TestMultilineDescriptionSection(t *testing.T) { +func TestMultilineRawDescription(t *testing.T) { helmValues := parseYamlValues(` animals: # -- (list) I mean, dogs are quite nice too... - # @section + # @raw # # List of default dogs: # - Umbra diff --git a/pkg/helm/chart_info.go b/pkg/helm/chart_info.go index 01737c8..cdf95a2 100644 --- a/pkg/helm/chart_info.go +++ b/pkg/helm/chart_info.go @@ -16,7 +16,7 @@ import ( ) var valuesDescriptionRegex = regexp.MustCompile("^\\s*#\\s*(.*)\\s+--\\s*(.*)$") -var sectionDescriptionRegex = regexp.MustCompile("^\\s*#\\s+@section") +var rawDescriptionRegex = regexp.MustCompile("^\\s*#\\s+@raw") var commentContinuationRegex = regexp.MustCompile("^\\s*#(\\s?)(.*)$") var defaultValueRegex = regexp.MustCompile("^\\s*# @default -- (.*)$") var valueTypeRegex = regexp.MustCompile("^\\((.*?)\\)\\s*(.*)$") diff --git a/pkg/helm/comment.go b/pkg/helm/comment.go index 16029f7..b8803c8 100644 --- a/pkg/helm/comment.go +++ b/pkg/helm/comment.go @@ -44,15 +44,15 @@ func ParseComment(commentLines []string) (string, ChartValueDescription) { c.Description = valueTypeMatch[2] } - var isSection = false + var isRaw = false for _, line := range commentLines[docStartIdx+1:] { - sectionFlagMatch := sectionDescriptionRegex.FindStringSubmatch(line) + rawFlagMatch := rawDescriptionRegex.FindStringSubmatch(line) defaultCommentMatch := defaultValueRegex.FindStringSubmatch(line) notationTypeCommentMatch := valueNotationTypeRegex.FindStringSubmatch(line) - if !isSection && len(sectionFlagMatch) == 1 { - isSection = true + if !isRaw && len(rawFlagMatch) == 1 { + isRaw = true continue } @@ -68,7 +68,7 @@ func ParseComment(commentLines []string) (string, ChartValueDescription) { commentContinuationMatch := commentContinuationRegex.FindStringSubmatch(line) - if isSection { + if isRaw { if len(commentContinuationMatch) > 1 { c.Description += "\n" + commentContinuationMatch[2]