link
元素
元素函数可以通过 set 和 show 规则进行样式自定义。
Links to a URL or a location in the document.
By default, links are not styled any different from normal text. However, you can easily apply a style of your choice with a show rule.
Example
#show link: underline
https://example.com \
#link("https://example.com") \
#link("https://example.com")[
See example.com
]
Syntax
This function also has dedicated syntax: Text that starts with http://
or
https://
is automatically turned into a link.
参数
参数是函数的输入,它们在函数名称后面的括号中传入。
dest
The destination the link points to.
-
To link to web pages,
dest
should be a valid URL string. If the URL is in themailto:
ortel:
scheme and thebody
parameter is omitted, the email address or phone number will be the link's body, without the scheme. -
To link to another part of the document,
dest
can take one of three forms:-
A label attached to an element. If you also want automatic text for the link based on the element, consider using a reference instead.
-
A dictionary with a
page
key of type integer andx
andy
coordinates of type length. Pages are counted from one, and the coordinates are relative to the page's top left corner.
-
查看示例
= Introduction <intro>
#link("mailto:hello@typst.app") \
#link(<intro>)[Go to intro] \
#link((page: 1, x: 0pt, y: 0pt))[
Go to top
]
body
The content that should become a link.
If dest
is an URL string, the parameter can be omitted. In this case,
the URL will be shown as the link.