Badges for Foliant.
Project description
Badges
Preprocessor for Foliant which helps to add badges to your documents. It uses Shields.io to generate badges.
Installation
$ pip install foliantcontrib.badges
Config
To enable the preprocessor, add badges
to preprocessors
section in the project config:
preprocessors:
- badges
The preprocessor has a number of options:
preprocessors:
- badges:
server: 'https://img.shields.io'
as_object: true
add_link: true
vars:
jira_path: localhost:3000/jira
package: foliant
server
: Shields server URL, which hosts badges. default: https://img.shields.io
as_object
: If true
— preprocessor inserts svg
badges with HTML <object>
tag, instead of Markdown image tag (![]()
). This is required for links and hints to work. default: true
add_link
: If true
preprocessor tries to determine the link which should be added to badge (for example, link to jira issue page for jira issue badge). Only works with as_object = true
. default: true
vars
: Dictionary with variables which will be replaced in badge urls. See variables section.
Usage
Just add the badge
tag and specify path to badge in the tag body:
<badge>jira/issue/https/issues.apache.org/jira/kafka-2896.svg</badge>
Variables
You can use variables in your badges to replace parts which repeat often. For example, if we need to add many badges to our Jira tracker, we may put the protocol and host parameters into a variable like this:
preprocessors:
- badges:
vars:
jira: https/issues.apache.org/jira
To reference a variable in a badge path use syntax ${variable}
:
<badge>jira/issue/${jira}/kafka-2896.svg</badge>
Description of the issue goes here. But it's not the only one.
<badge>jira/issue/${jira}/KAFKA-7951.svg</badge>
Description of the second issue.
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
Built Distribution
Hashes for foliantcontrib.badges-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8035775a60ea3777abc010c5a7c6d32654f5d504af3e3fc5fd8bf3054ad47320 |
|
MD5 | 9d2635c77d09e0b5a9600b1f0958cd74 |
|
BLAKE2b-256 | 1a64e4f0d4a8138f3574ac4904e585577f770731af6f5e8c6f0238ec12688f54 |
Hashes for foliantcontrib.badges-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81b3d6e45046d457c99819b2e977bc76426c6c3d8740c0e017403d3da3e714f |
|
MD5 | ef01eae383843f247a58e22eae2cd85e |
|
BLAKE2b-256 | 5cdcaaf4a13bfc3260dc8b4fea37f31b0b0e05b12826118550935a522ebf2674 |