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

Uploaded Python 3

File details

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

File metadata

  • Download URL: platzky_msgbar-0.1.7.tar.gz
  • Upload date:
  • Size: 6.1 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.7.tar.gz
Algorithm Hash digest
SHA256 4927260fbc94ffea7bb5fed1cadb1366ce5b5efbbc65af436f1d28de6f1bacdf
MD5 cfe786681995f620ce3cf48114238246
BLAKE2b-256 8a7d1747e69629ace6c160a596a3c4e617f313771fed1d054445df2addb7241c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: platzky_msgbar-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 94a62f812b2d43077af9e85d3443f6e800c8db227207676811810095a78e479b
MD5 65600193151369da75f5795a66811542
BLAKE2b-256 c05e511ef89f71576a25eab3841a15d6036cd7bb103efb38c45a93df4631465f

See more details on using hashes here.

Provenance

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