A Platzky plugin to show a message bar above the page
Project description
Msgbar Plugin
Overview
The msgbar plugin displays a message bar above the whole page with support for Markdown formatting and built-in XSS protection.
Installation
pip install platzky-msgbar
Usage
"plugins": [
{
"name": "msgbar",
"config": {
"message": "Your custom message goes here"
}
}
]
Markdown Support
The message field supports Markdown formatting including links:
{
"message": "Visit [our website](https://example.com) for more info!"
}
You can also use link attributes:
{
"message": "[Click here](https://example.com){:target=\"_blank\" rel=\"noopener\"}"
}
The message field is required. If you don't provide it, the plugin configuration will fail validation.
Configuration Options
All styling fields are optional. If not provided, the plugin will use fallback values from your Platzky theme configuration or built-in defaults.
Optional Styling Fields
-
background_color(string): CSS color value for the bar background- Falls back to Platzky's
primary_colorfrom database - Default:
#245466 - Accepts: hex (#RGB, #RRGGBB), rgb/rgba, hsl/hsla, named colors
- Falls back to Platzky's
-
text_color(string): CSS color value for the text- Falls back to Platzky's
secondary_colorfrom database - Default:
white - Accepts: hex, rgb/rgba, hsl/hsla, named colors
- Falls back to Platzky's
-
font_family(string): CSS font-family value- Falls back to Platzky's
fontfrom database - Default:
'Arial', sans-serif - Max length: 200 characters
- Falls back to Platzky's
-
font_size(string): CSS font-size value- Default:
14px - Accepts: number + unit (px, em, rem, %, vh, vw)
- Default:
-
bar_height(string): Height of the message bar- Default:
30px - Accepts: number + unit (px, em, rem, %, vh, vw)
- Default:
Complete Configuration Example
"plugins": [
{
"name": "msgbar",
"config": {
"message": "Visit [our website](https://example.com) for more info!",
"background_color": "#ff5733",
"text_color": "#ffffff",
"font_family": "'Courier New', monospace",
"font_size": "16px",
"bar_height": "40px"
}
}
]
Platzky Theme Integration
If your Platzky configuration includes theme settings in site_content, the plugin will automatically use them:
{
"site_content": {
"primary_color": "#123456",
"secondary_color": "#abcdef",
"font": "Roboto"
}
}
This allows the message bar to match your site's overall theme without additional configuration.
Security
The plugin implements comprehensive security measures to protect against injection attacks:
XSS Protection
- Only safe HTML tags are allowed:
a,strong,em,b,i,code,br,span - Dangerous content like
<script>tags,javascript:URLs, and event handlers are stripped - Links are restricted to safe protocols:
http,https,mailto
CSS Injection Protection
- All CSS configuration values (colors, sizes, fonts) are validated using Pydantic
- Colors must be valid hex, rgb/rgba, hsl/hsla, or named colors
- Sizes must follow the pattern:
number + unit(px, em, rem, %, vh, vw) - Font families cannot contain dangerous characters or CSS functions like
url() - Invalid values are automatically rejected and replaced with safe defaults
All security protections are always active and cannot be disabled.
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
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 platzky_msgbar-1.0.0.tar.gz.
File metadata
- Download URL: platzky_msgbar-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ddd3623aab96d90ad2653069111974f58d6f2a1202f4acc55310c694b7559c7
|
|
| MD5 |
2e2d5c26470321faba3cc6cba14929b3
|
|
| BLAKE2b-256 |
bddd0d8411fd9c62db10386afab261a700d45383c672a9d83347b065eebc2e08
|
Provenance
The following attestation bundles were made for platzky_msgbar-1.0.0.tar.gz:
Publisher:
release.yml on Problematy/platzky-msgbar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platzky_msgbar-1.0.0.tar.gz -
Subject digest:
3ddd3623aab96d90ad2653069111974f58d6f2a1202f4acc55310c694b7559c7 - Sigstore transparency entry: 937416880
- Sigstore integration time:
-
Permalink:
Problematy/platzky-msgbar@a74a14d5e6d33ff03703c116b2f6a8b78b04c097 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Problematy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a74a14d5e6d33ff03703c116b2f6a8b78b04c097 -
Trigger Event:
push
-
Statement type:
File details
Details for the file platzky_msgbar-1.0.0-py3-none-any.whl.
File metadata
- Download URL: platzky_msgbar-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eab76e0da24d4fda76d7a11422e69625fe33c0b6163d035361715678b356dda
|
|
| MD5 |
2206db194445fcb9fd16f4de10e19ab5
|
|
| BLAKE2b-256 |
851008a6e835ec4b25deba327b0488314ba5b53b5ae1c87117e45f6ae7fee7ca
|
Provenance
The following attestation bundles were made for platzky_msgbar-1.0.0-py3-none-any.whl:
Publisher:
release.yml on Problematy/platzky-msgbar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
platzky_msgbar-1.0.0-py3-none-any.whl -
Subject digest:
0eab76e0da24d4fda76d7a11422e69625fe33c0b6163d035361715678b356dda - Sigstore transparency entry: 937416904
- Sigstore integration time:
-
Permalink:
Problematy/platzky-msgbar@a74a14d5e6d33ff03703c116b2f6a8b78b04c097 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Problematy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a74a14d5e6d33ff03703c116b2f6a8b78b04c097 -
Trigger Event:
push
-
Statement type: