Skip to content

Commit 4ad6c82

Browse files
committed
fix: escapes dashes in version badges so complicated versions work fixes #56
1 parent f83a5b5 commit 4ad6c82

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: funky-version
3+
description: A very simple chart with a funky version
4+
version: "0.1.0-alpha-rc2"
5+
home: "https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version"
6+
sources: ["https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version"]
7+
engine: gotpl
8+
maintainers:
9+
10+
name: John Norwood
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# funky-version
2+
3+
![Version: 0.1.0-alpha-rc2](https://img.shields.io/badge/Version-0.1.0--alpha--rc2-informational?style=flat-square)
4+
5+
A very simple chart with a funky version
6+
7+
**Homepage:** <https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version>
8+
9+
## Maintainers
10+
11+
| Name | Email | Url |
12+
| ---- | ------ | --- |
13+
| John Norwood | [email protected] | |
14+
15+
## Source Code
16+
17+
* <https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version>
18+

example-charts/funky-version/values.yaml

Whitespace-only changes.

pkg/document/template.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func getVersionTemplates() string {
6262
versionBuilder := strings.Builder{}
6363
versionBuilder.WriteString(`{{ define "chart.version" }}{{ .Version }}{{ end }}\n`)
6464
versionBuilder.WriteString(`{{ define "chart.versionBadge" }}`)
65-
versionBuilder.WriteString("![Version: {{ .Version }}](https://img.shields.io/badge/Version-{{ .Version }}-informational?style=flat-square) ")
65+
versionBuilder.WriteString(`![Version: {{ .Version }}](https://img.shields.io/badge/Version-{{ .Version | replace "-" "--" }}-informational?style=flat-square) `)
6666
versionBuilder.WriteString("{{ end }}")
6767

6868
return versionBuilder.String()

0 commit comments

Comments
 (0)