PythonBlock
A Python block component that can be used to render a block of Python code.
import { PythonBlock } from "@alloy-js/python";
<PythonBlock opener="string"> {children}</PythonBlock>
import { PythonBlock } from "@alloy-js/python/stc";
PythonBlock({ opener: string }).children(children)
children | Children |
opener | optionalstring |
Example
Section titled “Example”<PythonBlock opener="def my_function()"> <VariableDeclaration name="x" type="int" /> <VariableDeclaration name="y" type="str" /></PythonBlock>
renders to
def my_function(): x: int = None y: str = None