TypstDocumentation

highlightElement
Question mark

Highlights text with a background color.

Example

This is #highlight[important].
Preview

Parameters
Question mark

fill
color
Settable
Question mark

The color to highlight the text with. (Default: 0xffff5f)

Default: rgb("#ffff5f")

View example
This is #highlight(fill: blue)[with blue].
Preview

top-edge
length or string
Settable
Question mark

The top end of the background rectangle.

Default: "ascender"

View example
#set highlight(top-edge: "ascender")
#highlight[a] #highlight[aib]

#set highlight(top-edge: "x-height")
#highlight[a] #highlight[aib]
Preview

bottom-edge
length or string
Settable
Question mark

The bottom end of the background rectangle.

Default: "descender"

View example
#set highlight(bottom-edge: "descender")
#highlight[a] #highlight[ap]

#set highlight(bottom-edge: "baseline")
#highlight[a] #highlight[ap]
Preview

extent
length
Settable
Question mark

The amount by which to extend the background to the sides beyond (or within if negative) the content.

Default: 0pt

View example
A long #highlight(extent: 4pt)[background].
Preview

body
content
RequiredPositional
Question mark

The content that should be highlighted.