Ref
A cross-reference that prints a number Format computed for another element.
A Ref is an inline cross-reference. It prints a number Format already worked out for the element named by to: a heading's section number, a counter's printed value, or the page it landed on.
Fields
| Name | Type | Description |
|---|---|---|
toRequired | string | The id to point at, a heading or a <Counter>. |
counter | string | When set, read this named counter's value at the target instead of the target's own number. |
page | boolean | When true, show the page the target landed on. Resolved after pagination, and it takes precedence over counter. |
counterStyle | string | The counter style to format the value in. Defaults to the document's numbering style, or decimal. |
Example
Point at a heading's id for its section number, and add page for the page it reached.
<Numbering />
<h1 id="method">Method</h1>
{/* ...later... */}
<p>The method in Section <Ref to="method" />, on page <Ref to="method" page />, settles every number first.</p><Numbering />
<h1 id="method">Method</h1>
<!-- ...later... -->
<p>The method in Section <Ref to="method" />, on page <Ref to="method" page />, settles every number first.</p><template data-type="numbering"></template>
<h1 id="method">Method</h1>
<!-- ...later... -->
<p>The method in Section <span data-type="ref" data-to="method"></span>, on page <span data-type="ref" data-to="method" data-page></span>, settles every number first.</p>Usage
A Ref reads a number Format already worked out for the element its to names. An id on a heading yields its section number once the document opts into numbering with a <Numbering>; an id on a <Counter> yields the value that Counter showed. Pass counter to read a named counter's value at the target instead of the target's own number, or page for the page the target landed on. When both are set, page wins.
References resolve before the document is divided into pages, so a Ref pointing further down reads the same as one pointing back. The page value is the exception: it is filled in once pages are settled.