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

Git changelog plugin enhancements #252

Closed
giladgd opened this issue Jul 11, 2024 · 9 comments
Closed

Git changelog plugin enhancements #252

giladgd opened this issue Jul 11, 2024 · 9 comments
Assignees
Labels
enhancement New feature or request good issue Good issue with descriptions or reproductions. 有着精良描述或者复现说明的 Issue pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog

Comments

@giladgd
Copy link
Contributor

giladgd commented Jul 11, 2024

The git changelog plugin is awesome!

However, there are some small things about it that I'd like to be able to configure before I can adopt it in my Vitepress website:

  1. For each line in the changelog, to be able to show the date as a relative time (e.g. 2 weeks ago) instead of a fixed date
  1. The ability to hide the Changelog h2 header (so the changelog component will just appear at the bottom of the page with no title)
  1. The ability to show the contributor for each commit on the commit itself on the changelog
  1. The ability to hide the "sort by" button
  1. I use Vitepress' transformPageData to modify frontmatter for pages, and having the changelog plugin respect those changes would make it easier for me to disable or enable it for specific pages

Thanks for making this awesome plugin :)

@nekomeowww nekomeowww added enhancement New feature or request good issue Good issue with descriptions or reproductions. 有着精良描述或者复现说明的 Issue pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog labels Jul 11, 2024
@nekomeowww nekomeowww self-assigned this Jul 11, 2024
@nekomeowww
Copy link
Member

I use Vitepress' transformPageData to modify frontmatter for pages, and having the changelog plugin respect those changes would make it easier for me to disable or enable it for specific pages.

What do you mean by respect those changes would make it easier for me to disable or enable it? You can always disable markdown affacted Nolebase plugins with

nolebase:
  <pluginNameCamelCase>: false

For git-changelog plugin, it is stated here: https://nolebase-integrations.ayaka.io/pages/en/integrations/vitepress-plugin-git-changelog/configure-vite-plugins#excluding-a-page-from-the-transformation-of-gitchangelogmarkdownsection

Is this what you are expecting to have?

@giladgd
Copy link
Contributor Author

giladgd commented Jul 11, 2024

In my .vitepress/config.ts file I have this code:

export default defineConfig({
    transformPageData(pageData) {
        if (pageData.filePath.startsWith("api/")) {
            pageData.frontmatter.editLink = false;
            pageData.frontmatter.lastUpdated = false;
            pageData.frontmatter ||= {};
            pageData.frontmatter.outline = [2, 3];

            // This doesn't seem to affect the page
            pageData.frontmatter.nolebase = {
                gitChangelog: false
            };
        }
    }
})

The problem is that the changelog still appears on pages where this code should have disabled it

@nekomeowww
Copy link
Member

I see. The git-changelog injected the markdown page too early at the time that the transformPageData hasn't been invoked yet. This might be a little bit tricky to deal with if you need to use GitChangelogMarkdownSection.

The only way to fix this is by manully mount and template the NolebaseGitChangelog and NolebaseGitContributors when creating the layout.

@nekomeowww
Copy link
Member

Anyway, welcome to Nolebase community!

Thank you so much for the rest of the feature requests, I accepted them.
Should be able to ship them ASAP since they are not relatively hard to implement.

And always, feel free to ask any questions 😄

@taskylizard
Copy link

Adding on this issue thread, it would be nice if github avatars of commit authors will be used by default instead of manually mapping authors in config.

@nekomeowww
Copy link
Member

Adding on this issue thread, it would be nice if github avatars of commit authors will be used by default instead of manually mapping authors in config.

@northword was this even possible?

@nekomeowww
Copy link
Member

@giladgd Btw, all accepted requests has been implemented and released.
Sorry that I forgot to close this but this issue should already be closed.

cc @taskylizard we can move to another issue to discuss this further.

@taskylizard
Copy link

Sure thing, thanks!

@giladgd
Copy link
Contributor Author

giladgd commented Aug 2, 2024

@nekomeowww Thank you for implementing everything :)
I've just tested it, and it works great!

I've opened a PR to use GitHub avatars when possible since I found that this is the main thing missing for me in the current implementation (#277)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good issue Good issue with descriptions or reproductions. 有着精良描述或者复现说明的 Issue pkg/git-changelog Related to @nolebase/vitepress-plugin-git-changelog
Projects
None yet
Development

No branches or pull requests

3 participants