diff options
| author | Martin Haug <mhaug@live.de> | 2022-12-20 15:31:36 +0100 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2022-12-20 15:55:15 +0100 |
| commit | b8ffd3ad3dcaebddbc674e03494e0d818b21fa51 (patch) | |
| tree | d33bbe2c2d2e0b37cdfd1031e16cbf9831a6a089 /library/src/meta/link.rs | |
| parent | b4b022940b908d8fe490b9f4f68bc60dcfb76cd2 (diff) | |
Document meta and data loading categories
Diffstat (limited to 'library/src/meta/link.rs')
| -rw-r--r-- | library/src/meta/link.rs | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/library/src/meta/link.rs b/library/src/meta/link.rs index 6a2f66df..3b816083 100644 --- a/library/src/meta/link.rs +++ b/library/src/meta/link.rs @@ -1,14 +1,47 @@ use crate::prelude::*; use crate::text::TextNode; -/// Link text and other elements to a destination. +/// Link to a URL or another location in the document. +/// +/// The link function makes its positional `body` argument clickable and links +/// it to the destination specified by the `dest` argument. +/// +/// # Example +/// ``` +/// #show link: underline +/// +/// #link("https://example.com") \ +/// #link("https://example.com")[ +/// See example.com +/// ] +/// ``` /// /// # Parameters /// - dest: Destination (positional, required) /// The destination the link points to. +/// +/// - To link to web pages, `dest` should be a valid URL string. If the URL is +/// in the `mailto:` or `tel:` scheme and the `body` 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` must contain a +/// dictionary with a `page` key of type `integer` and `x` and `y` +/// coordinates of type `length`. Pages are counted from one, and the +/// coordinates are relative to the page's top left corner. +/// +/// # Example +/// ``` +/// #link("mailto:hello@typst.app") \ +/// #link((page: 1, x: 0pt, y: 0pt))[ +/// Go to top +/// ] +/// ``` /// /// - body: Content (positional) -/// How the link is represented. Defaults to the destination if it is a link. +/// +/// 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. /// /// # Tags /// - meta |
