diff --git a/server/src/processing/cache-spec.md b/server/src/processing/cache-spec.md index 704d8cf5..ed7ee4bc 100644 --- a/server/src/processing/cache-spec.md +++ b/server/src/processing/cache-spec.md @@ -49,8 +49,9 @@ An `optional
content
` is a cross-reference to a `Target` or a gather element whose id is `ref`. The cache hydrates it to a link to that target; the link's content is the optional content if provided, or the target's inner HTML otherwise: `optional
content
`. This hydrated form is +id="generated-anchor" data-content="optional<br>content">optional
content
`. The generated `id` +is the anchor a backlink returns to (see below). This hydrated form is only present in the Client. Since the value of `data-content` is itself attribute-encoded (see below), its serialized form is encoded twice. @@ -59,7 +60,8 @@ Details: * This element allows no attribute except for `ref`; all other attributes are silently stripped during hydration. In particular, an `` is never a `Target`, so an `id` attribute is stripped. While hydration temporarily adds - the `data-content` and `contenteditable` attributes, dehydration removes them. + the `data-content` and `contenteditable` attributes and the backlink anchor + (see below), dehydration removes them. * The `` is marked `contenteditable="false"`; the optional content cannot be edited in the Client. @@ -116,8 +118,9 @@ Details: Including cache hydration would cause the inner HTML to be updated each time the file is processed, outdating the other file. Math hydration depends on nothing in the cache, so the inner HTML is hydrated like optional content each - time it's rendered, both here and in fragment backlinks (see - ). + time it's rendered: here, in fragment backlinks (see + ), and in the lead link of a displaced + backlink container. * If the `ref` attribute is missing, the `id` referred to isn't found, refers to a duplicate id or a fragment, or is an invalid CSS identifier, the content is @@ -128,6 +131,89 @@ Details: would create a circular dependency (see ); with it, there is none, but a single rule is simpler. +During hydration, each target displays one backlink for each authored `` +that resolves to it. Following a backlink returns to that occurrence in its +source file. For example, if a paragraph in `guide.md` contains two +`` elements, the `setup` target displays two +backlinks, one to each position in the paragraph. + +Generated backlinks and the anchors they return to appear only in the hydrated +HTML, and are excluded from cached target content, `Fragment::content` and +saved source; a target inside a fragment therefore carries no backlink +container into the gather lists which render that fragment. Backlinks render in +a separate container outside the target, `