A Go server app that generates progress bar badges
md endpoint takes url encoded markdown url, calculate the percentage based on checkboxes - [ ] and - [x] and return a progress badge
value endpoint just take the percentage in the path
Forked from this repo https://github.com/gepser/markdown-progress β
Tip
Don't hesitate to host it yourself but every snippet below is ready to paste into GitHub Markdown.
Markdown example : test-todo.md
Note
Note
Note
Note
Note
Note
Note
Note
GET /{percentage}HEAD /{percentage}
percentage can be an integer or float and is clamped to 0..100.
GET /md-progress?url={url}HEAD /md-progress?url={url}
url URL encoded of a markdown file containing checkboxes
dangerColorwarningColorsuccessColorbarColor(overrides the bar fill color)label(custom text inside the bar, max 64 chars)
All color values must be 6-character hex values without # (example: ff9900).
Only for / endpoint:
minmax
min and max must be provided together when used.
200 OK: valid request, returns SVG.400 Bad Request: invalid numeric input, range config, label length, or color format.405 Method Not Allowed: any method different fromGETorHEAD.500 Internal Server Error: template parse/render failure.
Headers for successful responses:
Content-Type: image/svg+xmlCache-Control: public, max-age=300
Tip
percentage values outside 0..100 are accepted and clamped automatically.
- The entry point for GCP function is
serverless.goandcmd/main.gois not included - For docker :
serverless.gois not included and there's no dependency - Locally : use
cmd/main.gowith unused GoogleCloudPlatform function dependency
This is for contained build and run but set up you're environment how you like.
Run locally:
just runTry it in a browser:
http://localhost:1983/76
just checkjust smoke http://localhost:1983The smoke test validates status codes, headers, and basic content contract.
Set your project first:
gcloud auth login
gcloud config set project THE_PROJECT_NAMEDeploy as an HTTP function with Progress as entrypoint:
gcloud functions deploy progress --gen2 --runtime go125 --entry-point Progress --trigger-http --allow-unauthenticated --region us-central1Important
This endpoint is intentionally public (allUsers invoker) so it can be used
directly from markdown image links across repos.
All the details in ./scripts/gcp-setup.sh and .github/workflow/deploy.yml
Run setup script : script/gcp-setup.sh
A docker image is created by the CI
docker run -p 1983:1983 ghcr.io/ad2ien/md-tasks-progress-badge:latestUsage :
This repo includes .github/workflows/deploy.yml to deploy automatically on
push to main (and manually via workflow_dispatch).
Required:
GCP_PROJECT_ID(example:progress-markdown)GCP_WORKLOAD_IDENTITY_PROVIDER(full resource name)GCP_SERVICE_ACCOUNT(deployer service account email)
Optional (defaults are already set in workflow):
GCP_REGION(us-central1)GCP_FUNCTION_NAME(progress)GCP_RUNTIME(go125)GCP_ENTRY_POINT(Progress)
CIworkflow runsgo testandgo veton pushes and PRs.Smoke Testsworkflow can be run manually (workflow_dispatch) with abase_urlinput.Deployworkflow deploys to GCP using OIDC/WIF.dockerbuild and push docker image to gh registry