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-0.1.6.tar.gz (5.6 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-0.1.6-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file platzky_msgbar-0.1.6.tar.gz.

File metadata

  • Download URL: platzky_msgbar-0.1.6.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for platzky_msgbar-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f0cdb8d2f9e845bc1cba30e5615f054bb639396901e5a96b458595e49d44f2c1
MD5 9131ab834dda4d2cad43fe3c14e842b5
BLAKE2b-256 6009190b3a8ffc0545ce842cc5e0e9ff76ecd149870ceeaee869a0214591b8a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for platzky_msgbar-0.1.6.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-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: platzky_msgbar-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a403d09905e3034ef6b121b455df8e6ddc33f09aea846eb1af8337125c77bea2
MD5 e82ff9ba782b422f6b1bc1a8a63b09be
BLAKE2b-256 cda13d3b6782672834f95cbdb54b4e03a5e3ec5ab3372c1ab46e815a10975757

See more details on using hashes here.

Provenance

The following attestation bundles were made for platzky_msgbar-0.1.6-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