Skip to main content

Static HTML/CSS renderer for panelmark shells.

Project description

panelmark-html

panelmark-html is the static HTML/CSS renderer for the panelmark ecosystem. Given a panelmark shell and its assigned interactions, it produces an HTML document or fragment representing the shell's panel structure.


What this package is

  • A static renderer: layout model in, HTML string out.
  • Useful for server-side rendering into Flask/Django templates, generating reports or dashboards, and automated snapshot tests.
  • The structural foundation that panelmark-web will build live interactivity on top of.

What this package is not

  • It does not handle browser events, keyboard or mouse input, or focus transitions.
  • It does not open sockets, HTTP routes, or sessions.
  • It does not render interaction-internal state (item lists, form fields, text content). Panel bodies are empty placeholders with stable DOM hooks; filling them in with live content is the job of panelmark-web.
  • It does not require JavaScript for its output to be valid HTML.

Relationship to panelmark-web

panelmark-html and panelmark-web are separate packages with distinct scopes.

Package Role
panelmark-html Static structure: panel layout, borders, headings, stable DOM hooks
panelmark-web Live layer: WebSocket sessions, browser events, interaction rendering, draw-command updates

panelmark-web depends on panelmark-html for its rendered structure. The DOM hooks and CSS classes defined here are the stable contract between the two packages.

Installation

pip install panelmark-html

Dependencies

  • panelmark — core layout model and shell state machine
  • No web framework dependency
  • No JavaScript build step

Status

Package maturity: Pre-alpha. The public Python API (render_fragment, render_document, get_base_css, HTMLRenderer) and higher-level rendering features may still evolve.

Hook contract: The region-level DOM hooks (data-pm-region, id, data-pm-* attributes) and CSS classes (.pm-shell, .pm-split-*, .pm-panel, .pm-panel-body) are the intended stable substrate for panelmark-web and are documented as such in docs/hook-contract.md. These will not change without a major version bump.

Quick start

from panelmark import Shell
from panelmark_html import render_fragment, get_base_css

LAYOUT = """
|=== <bold>My App</> ===|
|{$main$            }|
|==================|
|{2R $status$       }|
|==================|
"""

shell = Shell(LAYOUT)
html = render_fragment(shell)
# Panel bodies are empty — fill them with panelmark-web or your own renderer.
print(html)

For a complete HTML document including base CSS:

document = render_document(shell)
# Returns a full <html>...<body>...</body></html> string with embedded CSS.

API

Symbol Description
render_fragment(shell) Renders the shell as an HTML fragment (no <html> or <head> wrapper). Returns a string.
render_document(shell) Renders the shell as a complete HTML document, including the base CSS inline. Returns a string.
get_base_css() Returns the base CSS string for manual inclusion in your own template.
HTMLRenderer Low-level renderer class. Use this for custom integration or when you need per-region control.

All symbols are importable from panelmark_html. Full API reference: panelmark-html rendering API

Documentation

Document Description
Hook Contract Stable DOM interface: element structure, CSS classes, data-pm-* attributes, CSS custom properties. Canonical location — this repo.
Rendering API Reference Full reference for render_fragment, render_document, get_base_css, and HTMLRenderer
Ecosystem Overview How panelmark-html fits into the panelmark package ecosystem
Shell Language ASCII-art layout syntax reference
panelmark-web Live web runtime that builds on this package's hook contract

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

panelmark_html-0.2.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

panelmark_html-0.2.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file panelmark_html-0.2.0.tar.gz.

File metadata

  • Download URL: panelmark_html-0.2.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for panelmark_html-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8c1034cf157f364d1f574ce5f7426db7bd52fa9b7ed23fe528f9a139ff4638b1
MD5 6d15964d7883b663ab97ad9049af7b50
BLAKE2b-256 3f09ffe93fbea415ee6879db537ef79bb188fa6c0373b412473a5e45a72c7503

See more details on using hashes here.

File details

Details for the file panelmark_html-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: panelmark_html-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for panelmark_html-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb02cde9a57a19704dfe8a71c74797f0504f326a67705365ff1bae848fe8aa59
MD5 258f5a49e492f49df5ac040b9afed5cf
BLAKE2b-256 6785c649b209b6adae5836364a341ad4fab89957c37d37c6ae645ce54592e449

See more details on using hashes here.

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