Skip to content

Commit

Permalink
feat(style): use <sup> for author info
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jul 2, 2022
1 parent b105f30 commit b51c075
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cli
.option('--capitalize', 'Should capitalize for each comment message')
.option('--emoji', 'Use emojis in section titles', { default: true })
.option('--group', 'Nest commit messages under their scopes')
.option('--sup', 'Use <sup> for author info', { default: true })
.option('--dry', 'Dry run')
.help()

Expand Down
7 changes: 6 additions & 1 deletion src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ function formatLine(commit: Commit, options: ResolvedChangelogOptions) {
if (authors)
authors = `by ${authors}`

let refs = [authors, prRefs, hashRefs].filter(i => i?.trim()).join(' ')

if (options.sup && refs)
refs = `<sup>${refs}</sup>`

const description = options.capitalize ? capitalize(commit.description) : commit.description

return [description, authors, prRefs, hashRefs].filter(i => i?.trim()).join(' ')
return [description, refs].filter(i => i?.trim()).join(' ')
}

function formatTitle(name: string, options: ResolvedChangelogOptions) {
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export interface ChangelogOptions extends Partial<ChangelogenOptions> {
* @default true
*/
emoji?: boolean
/**
* Use <sup> for author info
* @default true
*/
sup?: boolean
}

export type ResolvedChangelogOptions = Required<ChangelogOptions>
Expand Down

0 comments on commit b51c075

Please sign in to comment.