{"route":"/en-US-v0.13.1/reference/model/link/","title":"Link","description":"Documentation for the `link` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"hyphenation","name":"Hyphenation","children":[]},{"id":"syntax","name":"Syntax","children":[]},{"id":"parameters","name":"Parameters","children":[{"id":"parameters-dest","name":"dest","children":[]},{"id":"parameters-body","name":"body","children":[]}]}],"body":{"kind":"func","content":{"path":[],"name":"link","title":"Link","keywords":[],"oneliner":"Links to a URL or a location in the document.","element":true,"contextual":false,"deprecation":null,"details":"<p>Links to a URL or a location in the document.</p>\n<p>By default, links do not look any different from normal text. However,\nyou can easily apply a style of your choice with a show rule.</p>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">show</span> <span class=\"typ-func\">link</span><span class=\"typ-punct\">:</span> <span class=\"typ-func\">underline</span>\n\n<span class=\"typ-link\">https://example.com</span> <span class=\"typ-escape\">\\</span>\n\n<span class=\"typ-func\">#</span><span class=\"typ-func\">link</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;https://example.com&quot;</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">link</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;https://example.com&quot;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  See example.com\n<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/9817d02583b839b8c8cae2e2fc58ca7e.png\" alt=\"Preview\"></div></div>\n<h2 id=\"hyphenation\">Hyphenation</h2>\n<p>If you enable hyphenation or justification, by default, it will not apply to\nlinks to prevent unwanted hyphenation in URLs. You can opt out of this\ndefault via <code><span class=\"typ-key\">show</span> <span class=\"typ-func\">link</span><span class=\"typ-punct\">:</span> <span class=\"typ-key\">set</span> <span class=\"typ-func\">text</span><span class=\"typ-punct\">(</span>hyphenate<span class=\"typ-punct\">:</span> <span class=\"typ-key\">true</span><span class=\"typ-punct\">)</span></code>.</p>\n<h2 id=\"syntax\">Syntax</h2>\n<p>This function also has dedicated syntax: Text that starts with <code>http://</code> or\n<code>https://</code> is automatically turned into a link.</p>","example":null,"self":false,"params":[{"name":"dest","details":"<p>The destination the link points to.</p>\n<ul>\n<li>\n<p>To link to web pages, <code>dest</code> should be a valid URL string. If the URL\nis in the <code>mailto:</code> or <code>tel:</code> scheme and the <code>body</code> parameter is\nomitted, the email address or phone number will be the link's body,\nwithout the scheme.</p>\n</li>\n<li>\n<p>To link to another part of the document, <code>dest</code> can take one of three\nforms:</p>\n<ul>\n<li>\n<p>A <a href=\"/en-US-v0.13.1/reference/foundations/label/\" title=\"label\">label</a> attached to an element. If you also want automatic text\nfor the link based on the element, consider using a\n<a href=\"/en-US-v0.13.1/reference/model/ref/\">reference</a> instead.</p>\n</li>\n<li>\n<p>A <a href=\"/en-US-v0.13.1/reference/introspection/location/\" title=\"`location`\"><code>location</code></a> (typically retrieved from <a href=\"/en-US-v0.13.1/reference/introspection/here/\" title=\"`here`\"><code>here</code></a>, <a href=\"/en-US-v0.13.1/reference/introspection/locate/\" title=\"`locate`\"><code>locate</code></a> or\n<a href=\"/en-US-v0.13.1/reference/introspection/query/\" title=\"`query`\"><code>query</code></a>).</p>\n</li>\n<li>\n<p>A dictionary with a <code>page</code> key of type <a href=\"/en-US-v0.13.1/reference/foundations/int/\">integer</a> and <code>x</code> and\n<code>y</code> coordinates of type <a href=\"/en-US-v0.13.1/reference/layout/length/\" title=\"length\">length</a>. Pages are counted from one, and\nthe coordinates are relative to the page's top left corner.</p>\n</li>\n</ul>\n</li>\n</ul>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-heading\">= Introduction</span> <span class=\"typ-label\">&lt;intro&gt;</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">link</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;mailto:hello@typst.app&quot;</span><span class=\"typ-punct\">)</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">link</span><span class=\"typ-punct\">(</span><span class=\"typ-label\">&lt;intro&gt;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>Go to intro<span class=\"typ-punct\">]</span> <span class=\"typ-escape\">\\</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">link</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">(</span>page<span class=\"typ-punct\">:</span> <span class=\"typ-num\">1</span><span class=\"typ-punct\">,</span> x<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">,</span> y<span class=\"typ-punct\">:</span> <span class=\"typ-num\">0pt</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  Go to top\n<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/afe2f0708d82d4ae0eb545a1b6f83c42.png\" alt=\"Preview\"></div></div>","types":["str","label","location","dictionary"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"body","details":"<p>The content that should become a link.</p>\n<p>If <code>dest</code> is an URL string, the parameter can be omitted. In this case,\nthe URL will be shown as the link.</p>","example":null,"types":["content"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["content"],"scope":[]}}}