We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add a docs macro that outputs a JSON badge:
@env.macro def get_coverage(): data = json.load(Path("htmlcov/coverage.json").read_text()) value = int(data["totals"]["percent_covered"]) for threshold, hex in ( (95, "#4c1"), # brightgreen (90, "#97CA00"), # green (75, "#a4a61d"), # yellowgreen (60, "#dfb317"), # yellow (40, "#fe7d37"), # orange (0, "#e05d44"), # red ): if value >= threshold: color = hex break return {"value": value, "color": color}
add a templated file coverage_badge.json to the docs:
coverage_badge.json
{% with get_coverage() as coverage %} {"schemaVersion": 1, "label": "coverage", "message": "{{ coverage.value }}", "color": "{{ coverage.color }}"} {% endwith %}
add a badge to the readme pointing to that published JSON file:
[![coverage](https://img.shields.io/endpoint?url=https://namespace.github.io/project/coverage_badge.json)](https://namespace.github.io/project/coverage)
The text was updated successfully, but these errors were encountered:
Not possible to render a JSON file through MkDocs + macros unfortunately... Maybe I'll implement this in mkdocs-coverage.
Sorry, something went wrong.
No branches or pull requests
add a docs macro that outputs a JSON badge:
add a templated file
coverage_badge.json
to the docs:add a badge to the readme pointing to that published JSON file:
Boost priority
The text was updated successfully, but these errors were encountered: