Mkdocs plugin to display git authors of a page
Project description
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:
- mkdocs-git-committers-plugin for displaying authors' github user profiles
- mkdocs-git-revision-date-localized-plugin for displaying the last revision date
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:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mkdocs-git-authors-plugin-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05fffe98ade486efc7c0fc7852601a6a0b2389449b240be6321d1c5eb4687612 |
|
MD5 | b10a6ac6e4f36f93ae0776b8694e314c |
|
BLAKE2b-256 | a77f17922532322b66834e5188ef02840e809669550e6ec4b8dafe0093e92ea1 |
Hashes for mkdocs_git_authors_plugin-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51dbf3b00b0749f705e6091e9f0640a5dd893ab88a8e46fbfc6ab76360f81acc |
|
MD5 | 1c0cfd49e738efb32dd6633940244656 |
|
BLAKE2b-256 | 9199cef3997db77fbe6d50bfb89b0fef7d5a44b22d0458fb302a7f1dae2f93d8 |