{"route":"/en-US-v0.14.1/reference/introspection/here/","title":"Here","description":"Documentation for the `here` function.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"examples","name":"Examples","children":[]}],"body":{"kind":"func","content":{"path":[],"name":"here","title":"Here","keywords":[],"oneliner":"Provides the current location in the document.","element":false,"contextual":true,"deprecationMessage":null,"deprecationUntil":null,"details":[{"kind":"html","content":"<p>Provides the current location in the document.</p>\n<p>You can think of <code>here</code> as a low-level building block that directly extracts\nthe current location from the active <a href=\"/en-US-v0.14.1/reference/context/\" title=\"context\">context</a>. Some other functions use it\ninternally: For instance, <code>counter<span class=\"typ-punct\">.</span><span class=\"typ-func\">get</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code> is equivalent to\n<code>counter<span class=\"typ-punct\">.</span><span class=\"typ-func\">at</span><span class=\"typ-punct\">(</span><span class=\"typ-func\">here</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span></code>.</p>\n<p>Within show rules on <a href=\"/en-US-v0.14.1/reference/introspection/location/#locatable\">locatable</a> elements, <code><span class=\"typ-func\">here</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span></code>\nwill match the location of the shown element.</p>\n<p>If you want to display the current page number, refer to the documentation\nof the <a href=\"/en-US-v0.14.1/reference/introspection/counter/\" title=\"`counter`\"><code>counter</code></a> type. While <code>here</code> can be used to determine the physical\npage number, typically you want the logical page number that may, for\ninstance, have been reset after a preface.</p>\n<h2 id=\"examples\">Examples</h2>\n<p>Determining the current position in the document in combination with the\n<a href=\"/en-US-v0.14.1/reference/introspection/location/#definitions-position\"><code>position</code></a> method:</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">context</span> <span class=\"typ-punct\">[</span>\n  I am located at\n  <span class=\"typ-func\">#</span><span class=\"typ-func\">here</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">position</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/e4fac373c1481ceacbb3fa948d38fa8b.png\" alt=\"Preview\"></div></div>\n<p>Running a <a href=\"/en-US-v0.14.1/reference/introspection/query/\" title=\"query\">query</a> for elements before the current position:</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-heading\">= Introduction</span>\n<span class=\"typ-heading\">= Background</span>\n\nThere are\n<span class=\"typ-key\">#</span><span class=\"typ-key\">context</span> <span class=\"typ-func\">query</span><span class=\"typ-punct\">(</span>\n  <span class=\"typ-func\">selector</span><span class=\"typ-punct\">(</span>heading<span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">before</span><span class=\"typ-punct\">(</span><span class=\"typ-func\">here</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">len</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\nheadings before me.\n\n<span class=\"typ-heading\">= Conclusion</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.14.1/assets/e43587e9371906b123b86b92c0aa9ff0.png\" alt=\"Preview\"></div></div>\n<p>Refer to the <a href=\"/en-US-v0.14.1/reference/foundations/selector/\" title=\"`selector`\"><code>selector</code></a> type for more details on before/after selectors.</p>"}],"self":false,"params":[],"returns":["location"],"scope":[]}}}