Usage
-
Install the Python bindings (uses the same payload as the
/renderHTTP handler): -
Run the working README example:
-
Or call the API directly:
= : =
Install the Python bindings (uses the same payload as the /render HTTP handler):
cd python-bindings
uv run maturin develop
Run the working README example:
uv run python examples/readme_example.py
Or call the API directly:
from dinja import render
PAYLOAD = {
"settings": {
"output": "schema", # "html", "javascript", or "schema"
"engine": "base", # "base" or "custom"
"minify": True,
"components": ["Hero", "Feature"],
},
"mdx": {
"home": "---\ntitle: Home\n---\n# Welcome\nThis is the **home page**",
"about": (
"---\ntitle: About\nauthor: Alice\n---\n"
"## About Us\nSome details {2+3} equals five"
),
"contact": (
"---\ntitle: Contact\ndescription: Contact us\n---\n"
"<Hero title={context('title')} description={context('description')} />"
),
},
# Supply component definitions when using the "custom" engine.
"components": None,
}
result: dict = render(PAYLOAD)
print(result)