codly / docs

Make it yours

Applies to code displayed in the documentation.

GitHub

codly.highlighted-line

Describes one whole line to highlight in codly.new.

Signature

typst code
codly.highlighted-line(line, color: none)

line is required and positional; color is optional and positional or named.

Fields

Field Type Default / required Meaning
line int Required, positional Displayed line number to highlight, including offsets and skips.
color none | paint none, positional Explicit background paint; none uses the next default highlight color transformed by codly.highlight.fill.

Behavior

The constructor also accepts named fields. The value casts from an integer, a dictionary with line and optional color, or an array of one or two values in field order; other values and array lengths fail to cast.

Example: Basic Usage

Typst source
#import "@preview/codly:2.0.0" as codly

#codly.new(
  ```text
  prepare()
  run()
  cleanup()
  ```,
  highlighted: (codly.highlighted-line(2, yellow.lighten(75%)),),
)
Edit & run on your device

The highlighted source and output update after you stop typing. Copy code includes your edits.

OUTPUTPre-rendered default
Rendered output of the Typst example