Skip to content

Commit

Permalink
fix: escapes dashes in version badges so complicated versions work fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
norwoodj committed Oct 3, 2020
1 parent f83a5b5 commit 4ad6c82
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions example-charts/funky-version/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
name: funky-version
description: A very simple chart with a funky version
version: "0.1.0-alpha-rc2"
home: "https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version"
sources: ["https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version"]
engine: gotpl
maintainers:
- email: norwood.john.m@gmail.com
name: John Norwood
18 changes: 18 additions & 0 deletions example-charts/funky-version/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# funky-version

![Version: 0.1.0-alpha-rc2](https://img.shields.io/badge/Version-0.1.0--alpha--rc2-informational?style=flat-square)

A very simple chart with a funky version

**Homepage:** <https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version>

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| John Norwood | norwood.john.m@gmail.com | |

## Source Code

* <https://github.com/norwoodj/helm-docs/tree/master/example-charts/funky-version>

Empty file.
2 changes: 1 addition & 1 deletion pkg/document/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func getVersionTemplates() string {
versionBuilder := strings.Builder{}
versionBuilder.WriteString(`{{ define "chart.version" }}{{ .Version }}{{ end }}\n`)
versionBuilder.WriteString(`{{ define "chart.versionBadge" }}`)
versionBuilder.WriteString("![Version: {{ .Version }}](https://img.shields.io/badge/Version-{{ .Version }}-informational?style=flat-square) ")
versionBuilder.WriteString(`![Version: {{ .Version }}](https://img.shields.io/badge/Version-{{ .Version | replace "-" "--" }}-informational?style=flat-square) `)
versionBuilder.WriteString("{{ end }}")

return versionBuilder.String()
Expand Down

0 comments on commit 4ad6c82

Please sign in to comment.