nolebase / integrations

✍️ A collection of diverse documentation engineering tools. Better reading experience, inline link preview, highlight targeted title, enhanced <mark> element, state-of-the-art SEO and <meta> generation, og image, thumbhash & blurhash images and more!
https://nolebase-integrations.ayaka.io
MIT License
118 stars 19 forks source link

Git changelog plugin enhancements #252

Closed giladgd closed 4 weeks ago

giladgd commented 1 month ago

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
    • 255

  2. The ability to hide the Changelog h2 header (so the changelog component will just appear at the bottom of the page with no title)
    • 256

  3. The ability to show the contributor for each commit on the commit itself on the changelog
    • 258

  4. The ability to hide the "sort by" button
    • 257

  5. 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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 4 weeks ago

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 commented 4 weeks ago

@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 commented 4 weeks ago

Sure thing, thanks!

giladgd commented 3 weeks ago

@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)