Page API Reference
Reference documentation for methods and properties of the Page class.
| Member | Kind | Signature | Description |
|---|---|---|---|
title() | Method | title(text: str) | Appends a primary H1 heading to the page |
subtitle() | Method | subtitle(text: str) | Appends an H2 section heading |
text() | Method | text(content: str) | Appends a standard paragraph text element |
code() | Method | code(code: str, lang: str, filename: str) | Renders syntax-highlighted code block |
raw() | Method | raw(html_str: str) | Injects unescaped HTML directly into document stream |
__iadd__() | Method | page += component | Appends component blueprint instance to page content |
Method Example
demo_page.py
from metupy.page import Page
from metupy.components_blueprint import Alert
page = Page(title="API Showcase")
page.title("Main Heading")
page.subtitle("Sub Heading")
page.text("Standard text paragraph containing <code>inline code</code>.")
page.code("print('Hello World')", lang="python", filename="main.py")
page.raw("<div class='custom-box'>Raw HTML Content</div>")
page += Alert(title="Alert Box", message="Component added via += operator")