feat: format commit as markdown item
parent
063680ab31
commit
6a5d3fe235
|
@ -49,11 +49,11 @@ func (g *MarkdownGenerator) getLines(commits []convention.Commit) []string {
|
||||||
t := getType(commit.Type)
|
t := getType(commit.Type)
|
||||||
switch t {
|
switch t {
|
||||||
case addedType:
|
case addedType:
|
||||||
addedLines = append(addedLines, commit.RawHeader)
|
addedLines = append(addedLines, g.composeListItem(commit.RawHeader))
|
||||||
case fixedType:
|
case fixedType:
|
||||||
fixedLines = append(fixedLines, commit.RawHeader)
|
fixedLines = append(fixedLines, g.composeListItem(commit.RawHeader))
|
||||||
case othersType:
|
case othersType:
|
||||||
othersLines = append(othersLines, commit.RawHeader)
|
othersLines = append(othersLines, g.composeListItem(commit.RawHeader))
|
||||||
default:
|
default:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -73,9 +73,13 @@ func (g *MarkdownGenerator) getLines(commits []convention.Commit) []string {
|
||||||
|
|
||||||
func (g *MarkdownGenerator) composeVersionHeader() string {
|
func (g *MarkdownGenerator) composeVersionHeader() string {
|
||||||
year, month, day := g.t.Date()
|
year, month, day := g.t.Date()
|
||||||
return fmt.Sprintf("# %s (%d-%d-%d)", g.version, year, month, day)
|
return fmt.Sprintf("## %s (%d-%d-%d)", g.version, year, month, day)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *MarkdownGenerator) composeTypeHeader(t string) string {
|
func (g *MarkdownGenerator) composeTypeHeader(t string) string {
|
||||||
return fmt.Sprintf("## %s", t)
|
return fmt.Sprintf("### %s", t)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *MarkdownGenerator) composeListItem(text string) string {
|
||||||
|
return fmt.Sprintf("* %s", text)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[
|
[
|
||||||
"# CHANGELOG",
|
"# CHANGELOG",
|
||||||
"# v1.0.0 (1-1-1)",
|
"## v1.0.0 (1-1-1)",
|
||||||
"## Added",
|
"### Added",
|
||||||
"feat: description",
|
"* feat: description",
|
||||||
"## Fixed",
|
"### Fixed",
|
||||||
"## Others"
|
"### Others"
|
||||||
]
|
]
|
|
@ -1,8 +1,8 @@
|
||||||
[
|
[
|
||||||
"# CHANGELOG",
|
"# CHANGELOG",
|
||||||
"# v1.0.0 (1-1-1)",
|
"## v1.0.0 (1-1-1)",
|
||||||
"## Added",
|
"### Added",
|
||||||
"## Fixed",
|
"### Fixed",
|
||||||
"fix: description",
|
"* fix: description",
|
||||||
"## Others"
|
"### Others"
|
||||||
]
|
]
|
|
@ -1,8 +1,8 @@
|
||||||
[
|
[
|
||||||
"# CHANGELOG",
|
"# CHANGELOG",
|
||||||
"# v1.0.0 (1-1-1)",
|
"## v1.0.0 (1-1-1)",
|
||||||
"## Added",
|
"### Added",
|
||||||
"## Fixed",
|
"### Fixed",
|
||||||
"## Others",
|
"### Others",
|
||||||
"ci: description"
|
"* ci: description"
|
||||||
]
|
]
|
|
@ -1,11 +1,11 @@
|
||||||
[
|
[
|
||||||
"# CHANGELOG",
|
"# CHANGELOG",
|
||||||
"# v1.0.0 (1-1-1)",
|
"## v1.0.0 (1-1-1)",
|
||||||
"## Added",
|
"### Added",
|
||||||
"feat: description feat",
|
"* feat: description feat",
|
||||||
"## Fixed",
|
"### Fixed",
|
||||||
"fix: description fix",
|
"* fix: description fix",
|
||||||
"## Others",
|
"### Others",
|
||||||
"ci: description ci",
|
"* ci: description ci",
|
||||||
"build: description build"
|
"* build: description build"
|
||||||
]
|
]
|
Loading…
Reference in New Issue