section

mentions

Wire value: "mentions"

Appears on: Documentation Topic

1. How swift-docc-render consumes this

mentions is one of the section kinds a symbol page's primaryContentSections array can contain (alongside declarations, parameters, content, properties, the REST sections, etc.). The dispatch table lives in PrimaryContent.vue, which keys a componentFor(section) lookup and a parallel propsFor(section) lookup off section.kind, using the SectionKind constant map defined in constants/PrimaryContentSection.js:

componentFor(section) {
  return {
    ...
    [SectionKind.mentions]: Mentions,
  }[section.kind];
},
propsFor(section) {
  const { ..., mentions } = section;
  return {
    ...
    [SectionKind.mentions]: { mentions },
  }[kind];
},

For kind: "mentions", only the mentions array is passed through as a prop, straight from the section object, to Mentions.vue (internal component name MentionedIn). That component's full template:

<section v-if="topics.length" class="mentions">
  <LinkableHeading anchor="mentions">
    {{$t('mentioned-in')}}
  </LinkableHeading>
  <Mention v-for="topic in topics"
    :key="topic.identifier"
    :url="topic.url"
    :title="topic.title"
    :role="topic.role"
    :kind="topic.kind"
  />
</section>

The heading text ("Mentioned in" in en-US, from src/lang/locales/en-US.json line 224) is rendered by the shared LinkableHeading component, giving the section a stable #mentions anchor and an on-this-page entry — the same anchor/registration mechanism is duplicated in onThisPageRegistrator.js, which special-cases SectionKind.mentions to add a level-2 "Mentioned in" entry to the on-this-page nav.

The key computed property is topics(): the raw mentions array on the wire is a list of reference identifier strings, not objects. Mentions.vue takes at most the first five entries (.slice(0, 5)) and resolves each one through the referencesProvider mixin's this.references map (the render node's top-level references dictionary) before handing the resolved { identifier, url, title, role, kind } objects one at a time to Mention.vue, which renders a single link row:

<div class="link-block">
  <Reference :url="url" :role="role" :kind="kind" class="link">
    <TopicLinkBlockIcon class="mention-icon" :role="role" />
    {{ title }}
  </Reference>
</div>

So the render-side pipeline for this kind is: raw string identifiers → array truncated to 5 → each identifier looked up in references → rendered as an icon + link row via the generic Reference/TopicLinkBlockIcon components also used for ordinary topic links elsewhere in the UI. There is no bespoke mentions-specific link rendering; it reuses the standard "link block" presentation.

One more consumer worth noting: DocumentationTopic.vue's primaryContentSectionsSanitized computed property filters the mentions section out entirely when the current page's symbolKind is module — "Mentioned in" is suppressed on module-level pages even if the section is present in the JSON.

See also: The references map — how this and every other reference-dictionary lookup works across kinds.

See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.

2. Example JSON and rendered mockup

No real JSON fixture was found. DocCArchive's own fixtures (ExampleDocs.doccarchive, SampleLibrary.doccarchive) only contain the literal string "mentions" inside the minified render-side JS bundle (js/documentation-topic.048469da.js) — the compiled Vue component code, not a data fixture — and neither archive's data/documentation/*.json files contain an actual mentions section (the feature depends on cross-references between articles and symbols that these fixtures don't happen to exercise). swift-docc's test suite has Tests/SwiftDocCTests/Rendering/MentionsRenderSectionTests.swift, which builds and asserts against a MentionsRenderSection Swift value programmatically, but does not include a literal JSON fixture either. The example below is hand-written to satisfy the vendored JSON Schema (#/components/schemas/MentionsRenderSection) exactly, using a plausible references entry of the kind Mentions.vue expects to resolve against.

{
  "mentions": [
    "doc://com.example.MentionedIn/documentation/MentionedIn/ArticleMentioningSymbol"
  ]
}

Paired reference entry (in the render node's top-level references map) that the identifier above resolves to:

{
  "doc://com.example.MentionedIn/documentation/MentionedIn/ArticleMentioningSymbol": {
    "identifier": "doc://com.example.MentionedIn/documentation/MentionedIn/ArticleMentioningSymbol",
    "kind": "article",
    "role": "article",
    "title": "Working with MyClass",
    "url": "/documentation/mentionedin/articlementioningsymbol",
    "type": "topic"
  }
}

Mentioned in

Working with MyClass

mockup: one resolved "Mentioned in" link row, icon + title, per entry in mentions (capped at 5)

3. Data sheet

Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object #/components/schemas/MentionsRenderSection (lines 2547–2560), which is the first branch of the DocumentationPrimaryRenderSection discriminated union (lines 2507–2546); cross-checked against the generated Components.Schemas.MentionsRenderSection struct in Sources/DocCArchive/generated/Types.swift (lines 6030–6044).

FieldTypeRequiredEnum values / defaultNote
mentions array of string yes — Generated as [Swift.String]. Each entry is a reference identifier string (a key into the render node's top-level references map), not an inline object — Mentions.vue resolves each string against this.references at render time.

Notably, unlike its sibling schemas in the DocumentationPrimaryRenderSection union (e.g. DeclarationsRenderSection, which has a required kind: "declarations" discriminator property), the vendored MentionsRenderSection schema has no kind property at all — mentions is the sole field, required, with no other properties, and no discriminator key is emitted on the wire for this section. This matches swift-docc's Swift-side model (Sources/SwiftDocC/Model/Rendering/Symbol/MentionsRenderSection.swift, lines 13–20), where kind is declared as a Swift-side default value (public var kind: RenderSectionKind = .mentions) used only for decoding dispatch (see Sources/SwiftDocC/Model/Rendering/RenderNode/CodableContentSection.swift lines 39–71, which peeks at kind to decide which concrete type to decode into) — the property itself is not part of MentionsRenderSection's own Codable conformance and is therefore absent from the encoded JSON, matching the vendored schema exactly. Because the JSON has no discriminator, the OpenAPI-generated DocumentationPrimaryRenderSection enum in Sources/DocCArchive/generated/Types.swift (lines 5895–5921) must be decoded by trying each candidate case in turn (a oneOf decode loop) — mentions is tried first, so a plain {"mentions": [...]} object will always decode as .MentionsRenderSection before any other candidate is attempted.

4. HTML/CSS mapping in DocC-Render output

Rendered DOM shape, from Mentions.vue and Mention.vue's templates:

SCSS: Mentions.vue itself defines no <style> block — its only layout contribution is the generic section spacing supplied by the parent PrimaryContent.vue's scoped :deep() rule (margin-top/margin-bottom: $section-spacing-single-side on every direct child). Mention.vue carries its own <style scoped lang="scss"> block (importing docc-render/styles/_core.scss) with the concrete rules:

No CSS custom properties (--...) are read directly in either Mentions.vue or Mention.vue; the icon and link colors come from the shared Reference/TopicLinkBlockIcon components' own styling, and the section-level border/spacing tokens (e.g. --colors-grid) are consumed one level up, by PrimaryContent.vue, for the shared top border above the whole primary-content column — not specific to mentions.

DocCArchive transform status: MyHTMLTransformer and MyMarkdownTransformer in Sources/DocCArchive/DocCArchive.swift are still stub placeholders (the HTML transformer returns a hardcoded <!-- what? --> comment and the Markdown transformer returns an empty string) — neither has any kind-specific handling for mentions (or any other render section) today; a consumer would need to resolve each mentions string against the render node's references map itself, the same way Mentions.vue does, since DocCArchive's generated MentionsRenderSection type carries only the raw identifier strings.

5. Modern CSS-only alternative

NOT APPLICABLE

Current behavior: Mentions.vue has exactly one piece of conditional behavior — a v-if="topics.length" guard that omits the whole <section> when there are no resolvable mentions — and one data transform, a computed property that slices the incoming array to 5 entries and maps each identifier through a static references lookup performed once at render time. Neither is interactive: there is no click handler, no toggle, no post-mount state change, and no show/hide behavior driven by user action. The v-if is equivalent to a server/build-time conditional include, and the 5-item cap and reference resolution are plain data-shaping that happens before the template ever renders, not runtime UI state.

Because there is no client-side state transition to reproduce, none of the stateful-CSS mechanisms (<details>/<summary>, checked radio + sibling selector, :target, the Popover API, <dialog>, :has()) apply here — they all exist to hold or toggle state in the DOM, and this section has none to hold. A static site generator emitting the DocC-Render markup can already reproduce the v-if behavior by simply not emitting the <section class="mentions"> element at all when the resolved mentions list is empty, and the 5-item cap and reference lookup are pure data preprocessing that any renderer (including a Swift-side DocCArchive transformer) would perform identically before emitting HTML — none of it depends on CSS or JavaScript running in the browser.