Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(git-changelog): add option to hide header #260

Merged
merged 1 commit into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading