Skip to content

Commit

Permalink
fix: proper display refs
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jun 13, 2022
1 parent 22818c6 commit 64d9c08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ export function generateMarkdown(commits: GitCommit[], config: ChangelogOptions)
const lines = group.reverse()
.map((commit) => {
const scope = commit.scope ? `**${commit.scope.trim()}:** ` : ''
const ref = `[\`${commit.references[0]}\`](https://github.com/${config.github}/commit/${commit.references[0]})`
const line = `- ${scope}${commit.description} ${ref}`
const refs = commit.references.map((r) => {
const url = r[0] === '#'
? `https://github.com/${config.github}/issues/${r.slice(1)}`
: `https://github.com/${config.github}/commit/${r}`
return `[\`${r}\`](${url})`
}).join(' ')
const line = `- ${scope}${commit.description} ${refs}`
if (commit.isBreaking) {
breakingChanges.push(line)
return undefined
Expand Down

0 comments on commit 64d9c08

Please sign in to comment.