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.

Source Distribution

mkdocs-git-authors-plugin-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_git_authors_plugin-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-git-authors-plugin-0.1.2.tar.gz.

File metadata

  • Download URL: mkdocs-git-authors-plugin-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for mkdocs-git-authors-plugin-0.1.2.tar.gz
Algorithm Hash digest
SHA256 92d833f709574ee3c2fdc1abda0cc330a187ef43697138047da486216cfe4cf2
MD5 344903bb8b31b01656bb98d0c4aad717
BLAKE2b-256 c1e6444d9e3caaf02afacac4a7800a369fe39a7634bce8c8f99381790996b882

See more details on using hashes here.

File details

Details for the file mkdocs_git_authors_plugin-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_git_authors_plugin-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

File hashes

Hashes for mkdocs_git_authors_plugin-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0486a0b08b5ba83536ce82389289c18f0155de484b460d94e1117b55179c0a8a
MD5 0089a9774ce84df114dbe5a1d85fac27
BLAKE2b-256 936dd31769ae5af4ed2416db71937c1fdc4996513eff3f142a61885a7a40c6c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page