情報 / Info
当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「Typst Japanese Community」がTypst v0.14.0の公式ドキュメントを翻訳したものです。誤訳や古い情報が含まれている可能性があるため、公式ドキュメントとの併用を推奨します。翻訳の改善やサイトの機能向上について、GitHubでのIssueやPull Requestを歓迎します。コミュニティにご興味のある方はDiscordサーバー「くみはんクラブ」にぜひご参加ください。
This site provides a Japanese translation of the Typst v0.14.0 documentation maintained by the "Typst Japanese Community" with permission from Typst GmbH. We recommend using this alongside the official documentation. We welcome contributions through Issues and Pull Requests on our GitHub repository for both translation improvements and website enhancements. Feel free to join our Discord server "Kumihan Club".
部分的に翻訳済み

このページは部分的に翻訳されています。一部原文の内容が含まれています。

link
要素関数
要素関数
要素関数はsetルールやshowルールでカスタマイズできます。

URLや文書中の位置へのリンク。

デフォルトでは、リンクの外見は通常のテキストと変わりません。 しかし、showルールを使うことで、簡単に任意のスタイルを適用できます。

#show link: underline

https://example.com \

#link("https://example.com") \
#link("https://example.com")[
  See example.com
]
Preview

構文

この関数には専用の構文もあります。 http://https://で始まるテキストは、自動的にリンクに変換されます。

ハイフネーション

ハイフネーションや両端揃えを有効にしていても、意図しないURL中のハイフネーションを防ぐため、 デフォルトではリンクには適用されません。 これを無効化するには、show link: set text(hyphenate: true)を使用します。

Accessibility

The destination of a link should be clear from the link text itself, or at least from the text immediately surrounding it. In PDF export, Typst will automatically generate a tooltip description for links based on their destination. For links to URLs, the URL itself will be used as the tooltip.

In HTML export, a link to a label or location will be turned into a fragment link to a named anchor point. To support this, targets without an existing ID will automatically receive an ID in the DOM. How this works varies by which kind of HTML node(s) the link target turned into:

  • If the link target turned into a single HTML element, that element will receive the ID. This is, for instance, typically the case when linking to a top-level heading (which turns into a single <h2> element).

  • If the link target turned into a single text node, the node will be wrapped in a <span>, which will then receive the ID.

  • If the link target turned into multiple nodes, the first node will receive the ID.

  • If the link target turned into no nodes at all, an empty span will be generated to serve as a link target.

If you rely on a specific DOM structure, you should ensure that the link target turns into one or multiple elements, as the compiler makes no guarantees on the precise segmentation of text into text nodes.

If present, the automatic ID generation tries to reuse the link target's label to create a human-readable ID. A label can be reused if:

  • All characters are alphabetic or numeric according to Unicode, or a hyphen, or an underscore.

  • The label does not start with a digit or hyphen.

These rules ensure that the label is both a valid CSS identifier and a valid URL fragment for linking.

As IDs must be unique in the DOM, duplicate labels might need disambiguation when reusing them as IDs. The precise rules for this are as follows:

  • If a label can be reused and is unique in the document, it will directly be used as the ID.

  • If it's reusable, but not unique, a suffix consisting of a hyphen and an integer will be added. For instance, if the label <mylabel> exists twice, it would turn into mylabel-1 and mylabel-2.

  • Otherwise, a unique ID of the form loc- followed by an integer will be generated.

引数
引数
引数は関数への入力値です。関数名の後に括弧で囲んで指定します。

link(,)->

dest
必須引数
必須引数
必須引数は、関数を呼び出す際に必ず指定しなければなりません。
位置引数
位置引数
位置引数は順序通りに指定することで、引数名を省略して設定できます。

リンクの遷移先。

  • Webページにリンクする場合、destは有効なURL文字列である必要があります。 mailto:tel:のURLスキームを含むURLが指定され、 かつbodyパラメーターが省略された場合、 URLスキームを除いたメールアドレスまたは電話番号がリンクの本文になります。

  • 文書中の別の部分にリンクする場合、 destには次の3つのうちいずれかの形式を用いることができます。

    • 要素に付与されたlabel。 要素に基づいて自動的にリンクの本文を生成したい場合は、 referenceの使用を検討してください。

    • location(通常はherelocatequeryから取得される)。

    • integer型のpageキーとlength型のx座標、y座標を持つ辞書。 ページ番号は1から始まり、 座標はページの左上隅からの相対位置です。

例を表示
= Introduction <intro>
#link("mailto:hello@typst.app") \
#link(<intro>)[Go to intro] \
#link((page: 1, x: 0pt, y: 0pt))[
  Go to top
]
Preview

body
必須引数
必須引数
必須引数は、関数を呼び出す際に必ず指定しなければなりません。
位置引数
位置引数
位置引数は順序通りに指定することで、引数名を省略して設定できます。

リンクとして表示するコンテンツ。

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

原文(英語)を開く

検索