Skip to content

feat: support .mailmap for git co-authors and author exclusions in au… - #34

Open
luminoso wants to merge 2 commits into
jaywhj:mainfrom
luminoso:fix/mailmap-coauthors-and-exclusions
Open

feat: support .mailmap for git co-authors and author exclusions in au…#34
luminoso wants to merge 2 commits into
jaywhj:mainfrom
luminoso:fix/mailmap-coauthors-and-exclusions

Conversation

@luminoso

@luminoso luminoso commented Sep 2, 2026

Copy link
Copy Markdown

Git applies .mailmap to %aN and %aE author fields, but leaves the commit message body (%B) untouched. Because mkdocs-document-dates parses Co-Authored-By: trailers directly from the body text, co-authors bypass .mailmap rules.

This pull request resolves co-authors through git check-mailmap, adds author exclusion support to authors.yml, and prevents duplicate author avatars on the rendered page.

What changed

  • Mailmap resolution for co-authors (utils.py): parse_commit_authors now passes extracted Co-Authored-By: pairs through git check-mailmap, mapping variations and aliases to their canonical name and email.
  • Flexible authors.yml lookup (plugin.py): _load_authors_from_yaml indexes entries by dictionary key, configured name, and email so metadata attaches regardless of which identifier git returns.
  • Author exclusion flag (plugin.py): setting ignore: true or exclude: true on an author in authors.yml drops them from the rendered footer. This lets sites omit bots and service accounts without disabling git author tracking.
  • Author deduplication (plugin.py): _load_author_cached deduplicates entries by canonical author name, avoiding duplicate avatars when multiple aliases appear in history.

How to test

  1. Add a .mailmap entry pointing alias co-authors to a single identity:
    Jane Doe <jane@example.com> <jane.dev@example.com>
    
  2. Commit a markdown file with Co-Authored-By: Jane Dev <jane.dev@example.com>.
  3. Build the site with mkdocs build.
  4. Check the rendered HTML footer: the page displays Jane Doe <jane@example.com> instead of the raw trailer value.
  5. Add ignore: true to an author in authors.yml and rebuild: the author is omitted from the page footer.

…thors.yml

- Resolve Co-Authored-By trailers with git check-mailmap against .mailmap
- Match authors.yml entries by key, name, and email
- Support ignore/exclude flags in authors.yml to omit bots or system accounts
- Deduplicate authors by canonical name in _load_author_cached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant