codly / docs

Make it yours

Applies to code displayed in the documentation.

GitHub

codly.footer

Creates the footer element rendered below a code block.

Signature

typst code
// Create a footer element
codly.footer(
  body,
  repeat: false,
  align: center + horizon,
  inset: auto,
  fill: none,
  stroke: auto
)

// Equivalent set-rule for `codly.footer`
codly.footer-set_(..args)

// Equivalent show rule for `codly.footer`
codly.footer-show_(it => ...)

body is required and positional; all other fields are named.

Fields

Field Type Default / required Meaning
body none | content Required, positional Content displayed below the code rows.
repeat none | bool false Whether the footer repeats when the block spans multiple pages.
align none | alignment center + horizon Alignment of the footer cell content.
inset none | length | dictionary | auto auto Footer cell padding; auto inherits the grid inset.
fill none | paint | auto none Footer cell background, independent of code and number fills. none leaves it unfilled; auto uses the default footer fill.
stroke none | stroke | auto auto Footer cell border; auto inherits the grid stroke.

Behavior

Pass this element as the footer field of codly.new; plain content is also accepted there and wrapped with the defaults. A codly.footer-set_(...) rule supplies defaults, while fields set on an explicit codly.footer(...) take precedence. repeat controls whether the footer appears on continuation pages.

codly.footer-show_(callback) applies a show rule to footer elements; the callback receives the element and returns replacement content. For example, #show: codly.footer-show_(it => [#it]) preserves the footer body.

Example

Try the controls
luma(240)
Typst source
#import "@preview/codly:2.0.0" as codly

#codly.new(
  ```js
  const ready = true;
  ```,
  footer: codly.footer([Generated output], fill: footer-fill, inset: 5pt),
)
Edit & run on your device

The controls supply the example variables. Their definitions are hidden here; Copy code includes the current values and your edits.

OUTPUTPre-rendered default
Rendered output of the Typst example