Skip to content

Commit

Permalink
feat(git-changelog): add option to hide header (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
lulu0119 committed Jul 13, 2024
1 parent c2fb0c0 commit f2f6734
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,18 @@ const reversedCommits = computed(() => {
</script>

<template>
<h2 :id="t('changelog.titleId') || t('changelog.title')">
<h2 v-if="!options.hideHeader" :id="t('changelog.titleId') || t('changelog.title')">
{{ t('changelog.title') }}
<a class="header-anchor" :href="`#${t('changelog.titleId') || t('changelog.title')}`" :aria-label="`Permalink to '${t('changelog.title')}'`" />
</h2>
<em v-if="!commits.length" opacity="70">{{ t('noLogs', { omitEmpty: true }) || t('changelog.noData') }}</em>
<div v-if="!commits.length" :class="options.hideHeader && 'mt-6'" class="italic" opacity="70">
{{ t('noLogs', { omitEmpty: true }) || t('changelog.noData') }}
</div>
<div
v-else
:class="[
isFreshChange ? 'bg-green/16' : 'bg-$vp-custom-block-details-bg',
options.hideHeader && 'mt-6',
]"
class="vp-nolebase-git-changelog vp-nolebase-git-changelog-history vp-nolebase-git-changelog-history-list vp-nolebase-git-changelog-history-container"
rounded-lg p-4
Expand Down
4 changes: 4 additions & 0 deletions packages/vitepress-plugin-git-changelog/src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export interface Options {
* @default 7
*/
numCommitHashLetters?: number
/**
* Whether to hide the git-changelog h2 header
*/
hideHeader?: boolean
}

export interface Commit {
Expand Down

0 comments on commit f2f6734

Please sign in to comment.