Code
Code content with optional rendering metadata. Use 'source' for the code text, 'language' for syntax highlighting, and 'filename' when the rendered block should show a file label. A string value in a code fiel…
Metadata
Definition
#/$defs/Code
Type
object
Source
spec/schemas/opf.schema.json
Fields
source
Type: string · Required · Default: —
Source code text to display.
{
"source": "def greet(name: str) -> str:\n return f\"Hello, {name}!\""
}language
Type: string · Optional · Default: —
Language identifier used for syntax highlighting.
{
"language": "python"
}filename
Type: string · Optional · Default: —
Optional file label shown with the code block.
{
"filename": "app.py"
}