Skip to main content

Mkdocs plugin to display git authors of a page

Project description

Actions Status PyPI - Python Version PyPI PyPI - Downloads codecov

mkdocs-git-authors-plugin

MkDocs plugin to display git authors of a page. Only considers authors of the current lines in the page ('surviving code' using git blame).

Other MkDocs plugins that use information from git:

Setup

Install the plugin using pip:

pip install mkdocs-git-authors-plugin

Activate the plugin in mkdocs.yml:

plugins:
  - git-authors

Usage

In supported themes

no supported themes yet

In markdown pages

You can use {{ git_authors_summary }} to insert a summary of the authors of a page. Authors are sorted by their name and have a mailto: link with their email.

An example output:

<span class='git-authors'><a href='mailto:jane@abc.com'>Jane Doe</a><a href='mailto:john@abc.com'>John Doe</a></span>

Which renders as:

Jane Doe, John Doe

In theme templates

In theme templates you will have access to the jinja2 variable git_authors, which contains a list of authors dicts, like the following example:

[{
    'name' : 'Jane Doe',
    'email' : 'jane@abc.com',
    'last_datetime' : datetime.datetime(),
    'lines' : 200,
    'contribution' : '40.0%'
},
{
    'name' : 'John Doe',
    'email' : 'john@abc.com',
    'last_datetime' : datetime.datetime(),
    'lines' : 300,
    'contribution' : '60.0%'
}]

An example of how to use in your templates:

{% if git_authors %}
  {%- for author in git_authors -%}
    <a href="{{ author.email }}" title="{{ author.name }}">
      {{ author.name }}
    </a>,
  {%- endfor -%}
{% endif %}

Alternatively, you could use the simple preformatted {{ git_authors_summary }} to insert a summary of the authors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mkdocs-git-authors-plugin, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size mkdocs_git_authors_plugin-0.1.1-py3-none-any.whl (5.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size mkdocs-git-authors-plugin-0.1.1.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page