Add badges to your MkDocs page
Project description
mkdocs-badges
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:
poetry install && poetry run mkdocs serve -t <theme>
Themes that should work are mkdocs, readthedocs, and material.
Lint source code:
poetry run mypy
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):
poetry install && poetry run 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.5.2
- Fix warning on Python 3.14 (thanks @dstam)
Version 0.5.1
- Parse lines starting with whitespace (lists, admonitions, etc.), which were previously ignored.
This may cause issues if you use indented code blocks, since any badges in them will be replaced and visible as HTML code.
To fix this I recommend you use a fenced code block (using triple backticks).
You can also revert to the old behavior by setting the new option
ignore_lines_starting_with_whitespaceto true. - Migrated build process to poetry
- Fixed unit tests
Version 0.5.0
- Allow inline badges by surrounding them with
[and]. These values can be changed with the new settingsinline_badge_startandinline_badge_endin yourmkdocs.yml - Added
wingetinstall badge data - Added some sanity checks when parsing badge data
- Fix
pip_githubandpip_gitlabinstall badges
Version 0.4.5
- Allow setting a custom separator with
separatorin yourmkdocs.yml - Allow specifying badges in tables.
This uses a different separator (by default
^), which you can set usingtable_separatorin yourmkdocs.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 bothbrew-formulaandbrew_formulanotation.
Version 0.4.3
- Changed behavior of the
install_badge_dataoption. Instead of removing the defaults the specified file is merged with them - Changed install badge data.
Renamed
brewtobrew_formulaand addedbrew_cask,docker_hub, anddocker_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: Trueto the plugin config in yourmkdocs.yml
Version 0.4.1
- Now requires MkDocs 1.5 or newer
- The included script is now marked as
asyncby default, maybe improving loading times a tiny bit. This can be disabled by addingasync: Falseto the plugin config in yourmkdocs.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
|endat 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
docsfolder in the form of a mkdocs website - Added link badges
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mkdocs_badges-0.5.2.tar.gz.
File metadata
- Download URL: mkdocs_badges-0.5.2.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.9.6 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da295c7e0cd61f58dfc79cc5ad4063808da319d795a84e55c798e4942e84d642
|
|
| MD5 |
2799d629064f38008dc01c265587a78a
|
|
| BLAKE2b-256 |
709162a330ae4698f8b662a5633399920c711026ce83cc59ce81c00b4565e951
|
File details
Details for the file mkdocs_badges-0.5.2-py3-none-any.whl.
File metadata
- Download URL: mkdocs_badges-0.5.2-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.4 CPython/3.9.6 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dc547fe66e9de6bb85822ecb960e0eed6c3f3df864156acfcab2f99e7fdf2e9
|
|
| MD5 |
c9915e7aaa614de1eb4d7c5b05ac242e
|
|
| BLAKE2b-256 |
c903e8310a9ca4fbb23278049f64046ffdf9f681b976ddebf2b6bff9a33a6f5b
|