link
Element
Element functions can be customized with set
and show
rules.
Element functions can be customized with
set
and show
rules.URLや文書中の位置へのリンク。
デフォルトでは、リンクの外見は通常のテキストと変わりません。 しかし、showルールを使うことで、簡単に任意のスタイルを適用できます。
例
#show link: underline
https://example.com \
#link("https://example.com") \
#link("https://example.com")[
See example.com
]

ハイフネーション
ハイフネーションや両端揃えを有効にしていても、意図しないURL中のハイフネーションを防ぐため、
デフォルトではリンクには適用されません。
これを無効化するには、show link: set text(hyphenate: true)
を使用します。
構文
この関数には専用の構文もあります。
http://
やhttps://
で始まるテキストは、自動的にリンクに変換されます。
引数
Parameters are the inputs to a function. They are specified in parentheses after the function name.
Parameters are the inputs to a function. They are specified in parentheses after the function name.
dest
RequiredPositional
Positional parameters are specified in order, without names.
Positional parameters are specified in order, without names.
リンクの遷移先。
-
Webページにリンクする場合、
dest
は有効なURL文字列である必要があります。mailto:
やtel:
のURLスキームを含むURLが指定され、 かつbody
パラメーターが省略された場合、 URLスキームを除いたメールアドレスまたは電話番号がリンクの本文になります。 -
文書中の別の部分にリンクする場合、
dest
には次の3つのうちいずれかの形式を用いることができます。
View example
= Introduction <intro>
#link("mailto:hello@typst.app") \
#link(<intro>)[Go to intro] \
#link((page: 1, x: 0pt, y: 0pt))[
Go to top
]

body
リンクとして表示する内容。
dest
がURL文字列の場合、このパラメーターは省略可能です。
この場合、URLがリンクとして表示されます。