codly / docs

Make it yours

Applies to code displayed in the documentation.

GitHub

codly.smart-skip

Configures which omitted source-line gaps appear as collapsed skip rows when a code block displays selected ranges.

Signature

typst code
codly.smart-skip(
  first: bool | none = none,
  last: bool | none = none,
  rest: bool | none = none,
)

All fields are named and optional.

Fields

Field Type Default / required Meaning
first none | bool none Whether to display an omission row before the first selected range.
last none | bool none Whether to display an omission row after the last selected range.
rest none | bool none Whether to display omission rows between disjoint selected ranges.

Behavior

Pass this value to codly.new’s smart-skip field. A boolean casts to the same value for all three fields. A dictionary casts to this type: omitted rest defaults to false, and omitted first or last inherits rest. Thus (rest: true, first: false) enables middle skips and trailing skips, while suppressing a leading skip. With all three fields false, no automatic skips are inserted. A skip row is inserted only for a discontinuity in the displayed source lines; its represented length is the number of omitted lines.

Example: Basic Usage

Try the controls
true
Typst source
#import "@preview/codly:2.0.0" as codly

#codly.new(
  ```python
  def prepare():
      load_data()
      validate()
      transform()
      save()
      report()
      cleanup()
  ```,
  ranges: ((2, 3), (6, 7)),
  smart-skip: codly.smart-skip(first: false, last: false, rest: show-middle-gap),
)
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