The code function creates a styled code block, typically used for actual programming language source code (e.g., Python, C++).
Usage:
Pass a raw block (using triple backticks) as the body.
#code()[
```py
def hello():
print("world")
]
**Key Configuration Options:**
- `line-numbers`: `boolean`. Enables/disables line numbering.
- `indent-guides`: `stroke`. Visual guides for indentation.
- `tab-size`: `integer`. Number of spaces for a tab (automatically detected if not specified).
- `row-gutter`: `length`. Vertical space between lines.
- `column-gutter`: `length`. Horizontal space between line numbers and text.
- `inset`: `length`. Inner padding.
- `fill`: `color`. Background color.
- `stroke`: `stroke`. Border style.
- `main-text-styles`: `dictionary`. Styling for the raw text (supports Typst `text` function parameters).
- `line-number-styles`: `dictionary`. Styling for line numbers (supports Typst `text` function parameters).
#code(indent-guides: 1pt + gray)[
def fib(n):
return n
]