Add badges to your mkdocs page
Project description
mkdocs-badges
This package allows you to add badges to your mkdocs site.
Setup
Install the plugin using pip:
pip install mkdocs-badges
Then, add the plugin to your mkdocs.yml
:
plugins:
- search
- badges
If you have no
plugins
entry in your config file yet, you'll likely also want to add thesearch
plugin. MkDocs enables it by default if there is noplugins
entry set.
More information about plugins in the MkDocs documentation.
Usage
Badges are defined like this:
|@github:six-two/mkdocs-badges|
|@pip:mkdocs-badges|
|"Badge name":badge value|
|"Height":N/A|
This should create badges that look like this (actual colors will depend on your theme):
There are different types of badges.
Normal badges
Normal badges use the syntax |"Name":value|
.
They just render a badge, but do not react to clicks.
If you want to link to something, you can put the badge in a link like this:
[|"Github":mkdocs-badges|](q)
Install badges
Install badges can be used to tell users how to install software. They are defined like this:
|@github:six-two/mkdocs-badges|
Clicking on the badge name Github
will copy the command used to install the software (git clone https://github.com/six-two/mkdocs-badges
).
Clicking on the badge's value six-two/mkdocs-badges
will bring the user to the package's site (https://github.com/six-two/mkdocs-badges
).
The currently supported badge names can be seen in src/mkdocs_badges/install_badge.py
.
You can also edit that file to add any badge types you may need.
In the future I plan to read the data from a data file, so that users can add custom ones.
Configuration
Confiruration option | Type | Default value | Description |
---|---|---|---|
install_badges | bool | True |
Enables parsing of install badges. Use False to not parse them |
normal_badges | bool | True |
Enables parsing of normal badges. Use False to not parse them |
badge_css | str | "" |
Use a different CSS file for the badges. The given path will be added to extra_css , so that it is included on every page. If the file does not exist or an empty value is used, the default CSS is used. |
badge_js | str | "" |
Use a different JavaScirpt file for the badges. The given path will be added to extra_javascript , so that it is included on every page. If the file does not exist or an empty value is used, the default JavaScirpt code is used. |
TODO
- Load install badge data from a JSON/YAML file (and also make it customizable)
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_badges-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c89a9a5f9d91ba8550075fdc228b2e7195d614f1f2161641554a7c6293b51299 |
|
MD5 | 899a78a65ef5519cbb8ad070bd26d1a2 |
|
BLAKE2b-256 | 604de7d36ed39bf78f147f6309dfa03fe354410eacd72dfd6ea3132596d6740f |