Skip to main content

A MkDocs plugin to generate an authors page from a YAML file.

Project description

MkDocs Authors Plugin

tests PyPI - Python Version codecov GitHub License

A custom MkDocs plugin designed to dynamically generate an "Authors" page for your documentation site from a simple YAML file. This allows you to easily manage and display information about contributors without manually updating Markdown files.

The YAML format is kept consistent with Material's "Defining authors", which enables blog post author attribution. This means that if you are creating a blog you will not have to define .authors.yml twice. Note that authors can be used independently (without a blog) as well.

Features

  • Dynamic Page Generation: Automatically creates an authors.md page based on your .authors.yml file.

  • Configurable Paths: Easily customize the input YAML file name and the output Markdown page name.

  • Author Profiles: Supports fields for name, description, avatar, affiliation, email, and social media links.

Installation

You can install this plugin using pip:

pip install mkdocs-authors-plugin

If you are developing the plugin locally, navigate to the plugin's root directory (the one containing pyproject.toml) and install it in editable mode:

cd /path/to/your/mkdocs-authors-plugin/
pip install -e .

Usage

1. Configure mkdocs.yml

Add the authors plugin to your plugins list in your mkdocs.yml file. You also need to include the authors.md page in your nav section.

# mkdocs.yml
site_name: My Awesome Docs

plugins:
  - search
  - authors:
      # Optional: specify the authors file if it's not .authors.yml
      # authors_file: my_custom_authors.yaml
      # Optional: specify the output page name if it's not authors.md
      # output_page: team.md

nav:
  - Home: index.md
  - Authors: authors.md # This is the page that will be generated by the plugin
  - About: about.md

2. Create your .authors.yml file

Create an .authors.yml file in the root directory of your MkDocs documentation project (the same directory as mkdocs.yml). This file will contain the data for your authors.

The plugin expects a top-level authors key, under which each author is defined by a unique ID (e.g., author_one).

You can also define optional page parameters under page_params, such as an overall title and description.

# .authors.yml

# Optional: Define page-level parameters for the generated authors page
page_params:
  title: Our Project Team
  description: "Meet the team."
  avatar_size: 150           
  avatar_shape: circle      
  avatar_align: left

# Required: Define individual author data
authors:
  author_one:
    name: Author One
    description: Owner
    avatar: headshot_one.png
    affiliation: British Antarctic Survey
    email: author.one@example.com
    github: authorone
    linkedin: author-one-profile
    twitter: author_one_dev
    orcid: 0123-4567-8910-1112
  author_two:
    name: Author Two
    description: Maintainer
    avatar: headshot_two.png
    affiliation: UK Centre for Ecology & Hydrology
    # You can omit any fields not applicable to an author
  author_three:
    name: Author Three
    description: Core Contributor
    avatar: headshot_three.png
    affiliation: University of Edinburgh

3. Run MkDocs

Navigate to your main MkDocs documentation project root (the directory containing mkdocs.yml) and run:

mkdocs serve

The plugin will generate the authors.md page, and you should see it in your site's navigation.

Where is authors.md?

When mkdocs serve detects a file change in docs/ , it triggers a rebuild. If authors.md was written into docs/, that write itself is a "change," leading to an endless cycle of rebuilding.

To prevent this endless loop, the plugin adds a File object representing authors.md to MkDocs' internal list of files. This tells MkDocs that there is a page called authors.md that should be part of the documentation build. This mean a physical file does not have to exist at docs/authors.md.

Other plugins

If you wish to automatically generate authors based on a git repository, git-authors is a tidy plugin to do this.

The authors-plugin is developed for instances where you want to manually define an authors list, for example for a wider project team, or non-code contributors.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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_authors_plugin-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_authors_plugin-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_authors_plugin-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_authors_plugin-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for mkdocs_authors_plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 941b447e7faeb789c9b636ff8ba731d2561756bf6be7261e686e5ebc0ba9f5f9
MD5 2a27667e9f5d47eb8bb25423837ca2cd
BLAKE2b-256 458841688f042f2f5e23d8dce2f44ce5b3bc743d4e95db0871253a923fe95913

See more details on using hashes here.

File details

Details for the file mkdocs_authors_plugin-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_authors_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73d039559cee9af78bf6a9766bc11053c7b328442cf53117858af339c0e3cda6
MD5 16d12a1df9056e62ad86502de10b6395
BLAKE2b-256 e2077a9d179934f1fbdd8cc1f086003cc2ff782540fe9aa93b73d31909c24c7b

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