1. How swift-docc-render consumes this
The dispatch happens in
PrimaryContent.vue,
which renders a symbol's array of primary-content sections. It keys a lookup table on section.kind
via a SectionKind constant map (defined in
constants/PrimaryContentSection.js).
For SectionKind.parameters it selects the Parameters component and passes through the
section's parameters array as a prop:
componentFor(section) {
return {
...
[SectionKind.parameters]: Parameters,
...
}[section.kind];
},
propsFor(section) {
const { ..., parameters, ... } = section;
return {
...
[SectionKind.parameters]: { parameters },
...
}[kind];
},
The actual rendering happens in
Parameters.vue.
Its template root is a <section class="parameters"> containing a heading (via the shared
LinkableHeading component, anchored to "parameters" per
ContentSectionAnchors.js)
followed by a definition list (<dl>) built by iterating the parameters array — one
<dt class="param-name"> holding the parameter's name in a <code>
element, paired with one <dd class="param-content"> that delegates the parameter's
content (an array of standard RenderBlockContent blocks) to the generic
<ContentNode> component for recursive block rendering:
<section class="parameters">
<LinkableHeading :anchor="contentSectionData.anchor">
{{ $t(contentSectionData.title) }}
</LinkableHeading>
<dl>
<template v-for="param in parameters">
<dt class="param-name" :key="`${param.name}:name`">
<code>{{ param.name }}</code>
</dt>
<dd class="param-content" :key="`${param.name}:content`">
<ContentNode :content="param.content" />
</dd>
</template>
</dl>
</section>
This is a plain, stateless <dl> — no click handlers, no toggling, no reactive local state.
It is worth explicitly distinguishing this from a sibling component with a similar name:
ParametersTable.vue
is a grid-based table used for the REST-flavored kinds (restParameters, restHeaders,
restCookies) via RestParameters.vue, not for the plain-symbol parameters
kind documented on this page.
See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.
2. Example JSON and rendered mockup
No fixture containing a rendered RenderNode with "kind": "parameters" was found in either
DocCArchive's test fixtures (Tests/DocCArchiveTests/Fixtures/ExampleDocs.doccarchive and
SampleLibrary.doccarchive — their documented symbols don't happen to include a rendered Parameters
section) or in swift-docc's Tests/SwiftDocCTests/ suite (matches there were either
symbol-graph input files, i.e. the pre-render source data DocC consumes, or the unrelated
restParameters/REST-flavored kind). The example below is therefore hand-written.
{
"kind": "parameters",
"title": "Parameters",
"parameters": [
{
"name": "path",
"content": [
{
"type": "paragraph",
"inlineContent": [
{
"type": "text",
"text": "The file system location to read from."
}
]
}
]
},
{
"name": "encoding",
"content": [
{
"type": "paragraph",
"inlineContent": [
{
"type": "text",
"text": "The text encoding to assume when decoding the file's contents."
}
]
}
]
}
]
}
path- The file system location to read from.
encoding- The text encoding to assume when decoding the file's contents.
3. Data sheet
Per Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object ParametersRenderSection
(lines 2677–2698), which cross-checks against the generated
Components.Schemas.ParametersRenderSection struct in
Sources/DocCArchive/generated/Types.swift (lines 6218–6250), plus the nested
DocumentationParameter schema object (spec lines 2699–2716; generated type lines 6251–6268).
| Field | Type | Required? | Enum values / default | Note |
|---|---|---|---|---|
kind | string | yes | ["parameters"] (single-value enum) | Discriminator value; matches RenderSectionKind.parameters in swift-docc's Swift model. |
title | string | no | — | Not set by ParametersSectionTranslator in current swift-docc; the Vue component supplies its own localized heading text (sections.parameters → "Parameters") rather than reading this field. |
parameters | array of DocumentationParameter | yes | — | One entry per named parameter, in signature order. |
DocumentationParameter.name | string | yes | — | The parameter's local (non-external/non-argument-label) name, per swift-docc's ParameterRenderSection.name. |
DocumentationParameter.content | array of RenderBlockContent | yes | — | Free-form block content (paragraphs, lists, code blocks, etc.) describing the parameter; can be an empty array if the author wrote no description. |
Note on naming: the JSON Schema / generated Swift type name is ParametersRenderSection
(as given for this page's doccArchiveType), while swift-docc's own Swift source
(Sources/SwiftDocC/Model/Rendering/Symbol/ParameterRenderSection.swift, lines 12–21) defines
an identically-named public struct ParametersRenderSection: RenderSection, Equatable with a
parameters: [ParameterRenderSection] field — i.e. swift-docc's per-item type is called
ParameterRenderSection (singular) where the vendored JSON Schema/generated Swift calls the
equivalent per-item type DocumentationParameter. These are the same wire shape under two different
Swift type names in the two codebases; the JSON on the wire is identical either way.
4. HTML/CSS mapping in DocC-Render output
<section class="parameters">— root element, scoped styles inParameters.vue's<style scoped lang="scss">block.- Heading — rendered by the shared
LinkableHeadingcomponent (src/components/ContentNode/LinkableHeading.vue) as an<h2>(perContentSectionAnchors.js'slevel: 2forSectionKind.parameters), withid="parameters"set from theanchorprop, enabling deep-linking such as#parameters. <dl>— the parameter list; no dedicated class.<dt class="param-name">— wraps the parameter name in<code>; styled withfont-weight: $font-weight-semiboldandpadding-top: var(--spacing-param)(collapsed to0for the first item).<dd class="param-content">— wraps a nested<ContentNode>tree; adds indentation (padding-inline-start: 2rem) and, via:deep(), bolds any nested<dt>/indents any nested<dd>that the block content itself introduces (e.g. a nested definition list inside a parameter's prose).- Responsive behavior: at the
smallbreakpoint (mixin@include breakpoint(small), defined in the shared_core.scss), the inline-start padding on both.param-nameand.param-contentcollapses to0, since the section no longer needs to reserve indentation room on narrow viewports. - CSS custom property consumed:
--spacing-param. It is declared once, globally, insrc/styles/base/_typography.scss(--spacing-param: #{rem(28px)}), and is then overridden per-view inDocumentationTopic.vue's root style block (--spacing-param: var(--spacing-stacked-margin-large)) so the vertical rhythm between parameter entries tracks the surrounding topic page's stacked-content spacing scale rather than a hardcoded pixel value. - SCSS files involved:
Parameters.vue's own scoped block, the shareddocc-render/styles/_core.scssimport (for the breakpoint mixin and font-weight variable), and the two custom-property definition sites above.
5. Modern CSS-only alternative
Not applicable
Current behavior: Parameters.vue holds no component-local reactive state and has no
click/toggle/expand-collapse handlers of any kind — it is a straight, one-way v-for template
render of a static array into a <dl>, with the only interactive element being the
LinkableHeading's in-page anchor link (a plain <router-link> href, not a
JS-driven show/hide toggle). There is no analogue here to, say, a tab navigator's currentTitle plus
v-show pattern.
Because there is no interactive state to reproduce (no expand/collapse, no active/inactive selection, no
show/hide), none of the native state-holding mechanisms (<details>/<summary>,
radio+:checked, :target, the Popover API, <dialog>,
:has(), container queries, CSS anchor positioning, view-transitions) have anything to hold or
replace for this specific kind. The one piece of "state" on the page — which section is scrolled into view via
its #parameters anchor — is already handled by plain browser URL-fragment navigation
(id="parameters" + a normal link), which is itself already a native mechanism, not something
DocC-render is reimplementing in JS.