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

[Feature request] @vuepress/plugin-git supports a custom file list to calculate the contributor list #449

Closed
LucienZhang opened this issue Sep 19, 2021 · 6 comments · Fixed by #460

Comments

@LucienZhang
Copy link
Contributor

LucienZhang commented Sep 19, 2021

Feature request

Description

We are using the functionality of importing code block heavily in our project (e.g. @[code](../foo.js)). So we hope @vuepress/plugin-git calculate the contributor list based on not only the currently .md file, but also files from an optional custom file paths list, given by frontmatter

Proposed Solution

  1. @vuepress/plugin-git takes an optional argument gitContributionInclude (or other name you suggest) from frontmatter, which is a list of relative path to files
  2. update the argument here to a list of string, and pass it to the execution of git shortlog (calculating from multiple files is already supported by git)

Please let me know your opinion, we can try to implement and contribute if you think it's acceptable.

@meteorlxy
Copy link
Member

Sound reasonable. Users may want to include/exclude some files such as homepage or something.

Besides contributors, this should also work with createdTime and updatedTime. We could consider adding a universal option or individual options for them.

Contributions welcome!

@meteorlxy
Copy link
Member

Oops, I realize that I misunderstood your feature request.... I just thought you want an extra option to include / exlucde some files via plugin options. Sorry for not reading the description carefully.

What you want exactly is to display contributors of multiple files in a single page.

I could get your point, but I think it might not be a common usage. In fact, you can try to calculate the contributor list yourself in the extendsPageData hook.

@LucienZhang
Copy link
Contributor Author

@meteorlxy 😅Sorry if I didn't express myself clearly.

extra option to include / exlucde some files via plugin options.

We can already control it by the per page frontmatter options. A global option to the plugin can be more or less overlapping with the frontmatter options of default theme (although plugin is independent of default theme)

it might not be a common usage

There are some other scenarios:

  1. One provided an image to the project and the image is imported to the md file, but the contributor of the image is not credited properly.
  2. One contributed a Vue component which is used in a md file, but the owner of the Vue component isn't credited properly.

you can try to calculate the contributor list yourself in the extendsPageData hook.

That's exactly what the git plugin is doing. If we do it by our own, we are almost coping everything of this plugin and making some minor change to the calculation logic.

Could you please reconsider the request based on the scenarios mentioned above, thanks.

@Mister-Hope
Copy link
Member

Mister-Hope commented Sep 27, 2021

The both scenarios you mentioned should work under the current logic.

  • If someone is adding some images to a doc, he would change the markdown files to add it in the same pr (or commit), so should when adding the component

Only the below won't:

  • someone is changing a existing image
  • someone only commited images and components and later the owner added it

Besides if the component is used in multiple places, or the contributor is actually providing dozens of photos, I think declaring it in homepage footer or a copyright page manually should be better.

@LucienZhang
Copy link
Contributor Author

@Mister-Hope Thank you for replying.

yes of course in all the scenarios (image, Vue component, code block), the contributor of the external files can be attributed by modifying the md file at the same time. But that's not the point, the point is later on any contributions to these external resources (image, Vue component, code block) are not included (we can't ask all the contributors of the external files always leave a comment in md to track their contributions, can we?). I mean when someone wants to include the external resources in calculating git attributes, why don't we provide users an convinient option.

declaring it in homepage footer or a copyright page manually should be better.

Yes, there are many situations where the contributor list can be long, even in current logic. But the option should be users', they decide when to show the contributors per page or when provide an overall contributors map. How they decide doesn't contradict this request to provide this option in case they want.

@Mister-Hope
Copy link
Member

I agree with the pr you opened. That option would be nice.

meteorlxy pushed a commit to LucienZhang/vuepress-next that referenced this issue May 25, 2022
meteorlxy added a commit that referenced this issue May 25, 2022
Co-authored-by: meteorlxy <meteor.lxy@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment