Skip to main content

ref_points

Function ref_points 

Source
pub fn ref_points(
    kind: &XnoteKind,
    labels: &[LabelUse],
    content: Option<ContentRef>,
) -> Vec<RefPoint>
Expand description

The two reference points of one xnote of the xnote kind kind, labeled by labels and showing content where a reference shows content.

Every element that carries xnotes implements its Referenceable aspect with this function, called once per xnote, so that the collect stage finds its xnotes: the stage recognizes an xnote by these two points. labels are the labels the author wrote for the xnote, as labels_of or the references feature’s readers (label_uses_in) read them.

The function returns the two points in this order:

  1. The xnote’s own point, whose reference kind is the xnote kind’s name. It carries the labels and accepts the kind’s label_type alone. For a numbered xnote kind, the point counts in the kind’s counter (counter_name), advancing it by one, and is shown in the reference style (style_name); its anchor is built from its number, fn-1 (from its first label where it has no number), and it shows no content. For an unnumbered xnote kind, the point counts in no counter, its anchor is its first label or else is built from its position (fn--3kzmq), and a reference to it shows content.
  2. The mark’s point, of the reference kind <kind>-mark: no label, accepting none, no number, no content; its anchor is built from its position, with the prefix <label type>ref (fnref--1kzmq).

content is the xnote’s content where a reference can show it: inline content only, since a reference is itself inline. Pass None for content that holds blocks; a reference to such an unnumbered xnote then shows the label it was written with.

The points are returned wherever the node is placed, inside another xnote’s content too: an xnote inside an xnote is an xnote like any other.