Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

highlight元素
Question mark
0.8.0起可用Go to source

Highlights text with a background color.

Example

This is #highlight[important].

参数
Question mark

fill
none or color or gradient or tiling
可用set规则
Question mark
默认值:rgb("#fffd11a1")

The color to highlight the text with.

Expand展开示例
This is #highlight( fill: blue )[highlighted with blue].

stroke
none or length or color or gradient or stroke or tiling or dictionary
可用set规则
Question mark
默认值:(:)

The highlight’s border color. See the rectangle’s documentation for more details.

Expand展开示例
This is a #highlight( stroke: fuchsia )[stroked highlighting].

top-edge
length or str
可用set规则
Question mark
默认值:"ascender"

The top end of the background rectangle.

Expand展开示例
#set highlight(top-edge: "ascender") #highlight[a] #highlight[aib] #set highlight(top-edge: "x-height") #highlight[a] #highlight[aib]
VariantDetails
"ascender"The font’s ascender, which typically exceeds the height of all glyphs.
"cap-height"The approximate height of uppercase letters.
"x-height"The approximate height of non-ascending lowercase letters.
"baseline"The baseline on which the letters rest.
"bounds"The top edge of the glyph’s bounding box.

bottom-edge
length or str
可用set规则
Question mark
默认值:"descender"

The bottom end of the background rectangle.

Expand展开示例
#set highlight(bottom-edge: "descender") #highlight[a] #highlight[ap] #set highlight(bottom-edge: "baseline") #highlight[a] #highlight[ap]
VariantDetails
"baseline"The baseline on which the letters rest.
"descender"The font’s descender, which typically exceeds the depth of all glyphs.
"bounds"The bottom edge of the glyph’s bounding box.

extent
length
可用set规则
Question mark
默认值:0pt

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

Expand展开示例
A long #highlight(extent: 4pt)[background].

radius
relative or dictionary
可用set规则
Question mark
默认值:(:)

How much to round the highlight’s corners. See the rectangle’s documentation for more details.

Expand展开示例
Listen #highlight( radius: 5pt, extent: 2pt )[carefully], it will be on the test.

body
content
必需参数
Question mark
位置参数
Question mark

The content that should be highlighted.