mkdocs-unirate
MkDocs plugin that bakes live UniRate API exchange rates into your documentation at build time — through inline Markdown placeholders and a Jinja template global.
Installation
pip install mkdocs-unirate
Quick start
Add the plugin to mkdocs.yml:
plugins:
- unirate:
api_key: !ENV UNIRATE_API_KEY # or hard-code (not recommended)
base_currency: USD
currencies: [EUR, GBP, JPY]
strict: false
decimals: 4
Then drop placeholders into any Markdown page:
1 USD = {{ unirate_rate:USD:EUR }} EUR
100 USD converts to {{ unirate_convert:USD:JPY:100 }} JPY
Build with your key in the environment:
UNIRATE_API_KEY=your_key mkdocs build
Get a free key at unirateapi.com.
Placeholders
| Placeholder | Renders |
|---|---|
{{ unirate_rate:FROM:TO }} |
Current exchange rate for the pair |
{{ unirate_convert:FROM:TO:AMOUNT }} |
AMOUNT converted at the current rate |
Currency codes are case-insensitive and uppercased before the API call. Each distinct pair is fetched once per build and cached, so repeated placeholders cost a single request.
Jinja global
For pages rendered through Jinja (a custom theme, or
mkdocs-macros-plugin), a
unirate global is registered via on_env:
{{ unirate.base_currency }}
{{ unirate.rate("USD", "EUR") }}
{{ unirate.convert(250, "USD", "EUR") }}
{{ unirate.currencies | length }}
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
api_key |
str | "" |
UniRate API key. Falls back to UNIRATE_API_KEY env var. |
base_url |
str | "" |
Override the API base URL (rare — self-hosted proxy). |
base_currency |
str | "USD" |
Default base exposed to the Jinja global. |
currencies |
list | [] |
Currencies of interest (informational / templates). |
enable_markdown |
bool | true |
Toggle Markdown placeholder substitution. |
enable_jinja |
bool | true |
Toggle the unirate Jinja global. |
strict |
bool | false |
Fail the build on any UniRate error instead of warning. |
decimals |
int | 4 |
Decimal places for rendered values. |
timeout |
int | 30 |
HTTP request timeout in seconds. |
Error handling
On a UniRate error (bad key, unknown currency, rate limit, service outage):
strict: false(default) — a warning is logged and the original placeholder text is left untouched, so the build still succeeds.strict: true— the build aborts with a clear error message.
Status codes map to the canonical UniRate error taxonomy: 401 →
authentication, 404 → invalid currency, 429 → rate limit, 403 → Pro
subscription required, 503 → service unavailable.
Related UniRate clients
Other UniRate integrations: Python · Node.js · Go · Rust · Ruby · PHP · Java · Swift · .NET · FastAPI · Flask · Streamlit · Hugo · Jekyll · Eleventy · MCP Server · CLI
License
MIT — see LICENSE.
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_unirate-0.1.0.tar.gz.
File metadata
- Download URL: mkdocs_unirate-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a3720dbb6517b2be931c80cf79573e9957dcbb4eafb1c86833c7b7092c7045f
|
|
| MD5 |
fb79915a16ff5f7643a44f4faed611e6
|
|
| BLAKE2b-256 |
264d0c1cae417392b7cbb3ef59cbd54e350b579c28b58de8ea72c616970d29cf
|
Provenance
The following attestation bundles were made for mkdocs_unirate-0.1.0.tar.gz:
Publisher:
release.yml on UniRate-API/mkdocs-unirate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_unirate-0.1.0.tar.gz -
Subject digest:
3a3720dbb6517b2be931c80cf79573e9957dcbb4eafb1c86833c7b7092c7045f - Sigstore transparency entry: 2416342750
- Sigstore integration time:
-
Permalink:
UniRate-API/mkdocs-unirate@d246ec6eeea3f2ebd26698fab26f24f2dbd22989 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/UniRate-API
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d246ec6eeea3f2ebd26698fab26f24f2dbd22989 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mkdocs_unirate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mkdocs_unirate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24e08f14663807809d1f09810f172b9de61397e527326f7d7ebb23d4f292c0ab
|
|
| MD5 |
e839ceac26c442fd0a4beef3bd7951f4
|
|
| BLAKE2b-256 |
83ab0629b346fd59c1a0b4faebf563903a5c06da7f31b3eb31919df6ef253419
|
Provenance
The following attestation bundles were made for mkdocs_unirate-0.1.0-py3-none-any.whl:
Publisher:
release.yml on UniRate-API/mkdocs-unirate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mkdocs_unirate-0.1.0-py3-none-any.whl -
Subject digest:
24e08f14663807809d1f09810f172b9de61397e527326f7d7ebb23d4f292c0ab - Sigstore transparency entry: 2416342947
- Sigstore integration time:
-
Permalink:
UniRate-API/mkdocs-unirate@d246ec6eeea3f2ebd26698fab26f24f2dbd22989 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/UniRate-API
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d246ec6eeea3f2ebd26698fab26f24f2dbd22989 -
Trigger Event:
push
-
Statement type: