Skip to main content

Add badges to your MkDocs page

Project description

mkdocs-badges

PyPI version License Python versions

This package allows you to add badges to your MkDocs site.

Documentation

This README is just a short intro to the package. For a quick start and detailed information please see the documentation. The documentation is also available in the docs folder of the source code and can be built locally with MkDocs.

A development version built with the latest changes (HEAD commit) can be found at https://mkdocs-badges-dev.six-two.dev/.

Testing

The documentation also serves as a test of the plugin, especially the files under the Tests menu item.

Build the documentation with the latest source code:

pip install . && mkdocs serve -t <theme>

Themes that should work are mkdocs, readthedocs, and material.

Unit tests

The GitHub repository now contains some unit test. You can run them against the current code with the following command (issued in the root directory of the repository):

pip install . && python -m unittest

Known issues

  • At least on iPhones (which only support Safari based engines) only one toast can be shown. After that you need to reload the page to show the same toast again or to show another toast. This seems to be an issue with https://github.com/mlcheng/js-toast/ (used in src/mkdocs_badges/assets/badge.js) which seems no longer maintained.

Notable changes

Version 0.4.5

  • Allow setting a custom separator with separator in your mkdocs.yml
  • Allow specifying badges in tables. This uses a different separator (by default ^), which you can set using table_separator in your mkdocs.yml
  • Fixed some CSS bugs
  • Link badges (L) with non-URL values now cause a warning (instead of a crash)
  • Allow adding optional angle brackets in link badges (L) to prevent MD034 - Bare URL used linter warnings

Version 0.4.4

  • Rewrite - to _ in install badge types. This allows using both brew-formula and brew_formula notation.

Version 0.4.3

  • Changed behavior of the install_badge_data option. Instead of removing the defaults the specified file is merged with them
  • Changed install badge data. Renamed brew to brew_formula and added brew_cask, docker_hub, and docker_ghcr
  • Fixed crash of JavaScript copy code if the text contains a single quote

Version 0.4.2

  • Detect markdown tables even if they have only a single dash in the header. Fixes #4
  • Option to disable warnings (use this at your own risk) by adding disable_warnings: True to the plugin config in your mkdocs.yml

Version 0.4.1

  • Now requires MkDocs 1.5 or newer
  • The included script is now marked as async by default, maybe improving loading times a tiny bit. This can be disabled by adding async: False to the plugin config in your mkdocs.yml

Version 0.4.0

  • Now requires MkDocs 1.4 or newer
  • Updated the layout rules for badges. This should better handle oversized contents (like images or very long texts).

Version 0.3.4

  • Added single element badges

Version 0.3.3

  • Added tags badges

Version 0.3.1

  • Better error handling, fixed a crash
  • Started adding unit tests

Version 0.3.0

  • Breaking changes to the badges formats. See the migration guide
  • Added support for reference links

Version 0.2.0

  • Each badge now needs to be the only thing on its line
  • Badges inside code blocks are no longer parsed
  • The |end at the end of custom badges is no longer neccessary. A simple | is enough. This shorter form is recommended from now on.
  • Documentation is now in the docs folder in the form of a mkdocs website
  • Added link badges

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_badges-0.4.5.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

mkdocs_badges-0.4.5-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_badges-0.4.5.tar.gz.

File metadata

  • Download URL: mkdocs_badges-0.4.5.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mkdocs_badges-0.4.5.tar.gz
Algorithm Hash digest
SHA256 9a796fcd492b92270fa87f0818df474e8edd5a08f92a1555d22ae20f288cbc72
MD5 c318a4863f5dbe798deb35fe4d7e83c7
BLAKE2b-256 64e63710963e9c97c526c222c5a0b2629381bb049c04cb5fa2ea69adfec9c91e

See more details on using hashes here.

File details

Details for the file mkdocs_badges-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: mkdocs_badges-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for mkdocs_badges-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f440bf858df3f7e39c8e4eccf3a3491fc069676893659e2bb2755622d89c279e
MD5 8698f465d898ac9c2b2e92588ae2d75c
BLAKE2b-256 f735ebb920761d3add7bf64a1c42d2bba9e170efcf95f19946f26202487801e6

See more details on using hashes here.

Supported by

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