Skip to main content

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_color from database
    • Default: #245466
    • Accepts: hex (#RGB, #RRGGBB), rgb/rgba, hsl/hsla, named colors
  • text_color (string): CSS color value for the text

    • Falls back to Platzky's secondary_color from database
    • Default: white
    • Accepts: hex, rgb/rgba, hsl/hsla, named colors
  • font_family (string): CSS font-family value

    • Falls back to Platzky's font from database
    • Default: 'Arial', sans-serif
    • Max length: 200 characters
  • font_size (string): CSS font-size value

    • Default: 14px
    • Accepts: number + unit (px, em, rem, %, vh, vw)
  • bar_height (string): Height of the message bar

    • Default: 30px
    • Accepts: number + unit (px, em, rem, %, vh, vw)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

platzky_msgbar-1.0.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

platzky_msgbar-1.0.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

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

Hashes for platzky_msgbar-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3ddd3623aab96d90ad2653069111974f58d6f2a1202f4acc55310c694b7559c7
MD5 2e2d5c26470321faba3cc6cba14929b3
BLAKE2b-256 bddd0d8411fd9c62db10386afab261a700d45383c672a9d83347b065eebc2e08

See more details on using hashes here.

Provenance

The following attestation bundles were made for platzky_msgbar-1.0.0.tar.gz:

Publisher: release.yml on Problematy/platzky-msgbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for platzky_msgbar-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eab76e0da24d4fda76d7a11422e69625fe33c0b6163d035361715678b356dda
MD5 2206db194445fcb9fd16f4de10e19ab5
BLAKE2b-256 851008a6e835ec4b25deba327b0488314ba5b53b5ae1c87117e45f6ae7fee7ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for platzky_msgbar-1.0.0-py3-none-any.whl:

Publisher: release.yml on Problematy/platzky-msgbar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page